The last name to be removed from the ballot was Viktor Kurpitko, the candidate of the A Just Russia party, whose name will have to be manually crossed off ballots along with those of tycoon Alexander Lebedev and former presidential candidate Andrei Bogdanov.
Lebedev, the owner of London's Evening Standard newspaper, was struck off the ballot by a court decision on Monday, while Bogdanov withdrew from the race. Early voting has already begun, but any ballots cast for the three candidates will be considered invalid, the city election committee said.
From the 25 original applicants, voters will be able to choose from acting Mayor Anatoly Pakhomov of the governing United Russia party, former deputy prime minister Boris Nemtsov of the opposition Solidarity movement, Sochi Communist leader Yury Dzaganiya, regional LDPR head Alexei Kolesnikov, and businessmen Pavel Yemelyanenko and Vladimir Trukhanovsky.
The campaign in Sochi has been in the spotlight as the city prepares to host the 2014 Winter Olympics. The next mayor will likely have a major say in how billions of dollars in government funding for the Games is spent.
A host of high-profile candidates sought to take part, although many have since been ruled out, including former Bolshoi Theater ballerina Anastasia Volochkova and human rights ombudsman Dmitry Berdnikov.
The election will take place on April 26.