The disputed candidacies had stalled polls aimed at ending a four-year political crisis.
The new electoral court set up last week met to "clean" up the list of 41 candidates approved by its predecessor in May.
The other two controversial candidates who have been dropped for the revised list published on the court's website on Saturday were the ousted leader Marc Ravalomanana's wife Lalao, and former president Didier Ratsiraka.
Their candidacies, which did not meet electoral rules, have been internationally condemned and have delayed the much-awaited vote expected to lift the Indian Ocean island out of its political and economic mire. The three had refused to stand aside even in the face of threats of sanctions.
The court's move is sure to be welcomed by leaders of the 15-nation Southern African Development Community (SADC) meeting for their yearly summit in Malawi, where Madagascar is one of the top agenda items.
The coast is "now clear for the holding of credible elections whose result will be accepted by SADC", a diplomat at the summit who asked not be named told Agence France-Presse.
The African Union immediately welcomed the move in a statement, adding it should "mark the culmination of the process towards ending the crisis".
France's ambassador to Madagascar, Francois Goldblatt, tweeted he was glad to see "the conditions met for a normal and peaceful re-starting of the electoral process".
Madagascar, heavily reliant on international aid, has been mired in political limbo since Rajoelina, a former disc jockey and ex-mayor of the capital Antananarivo, seized power in 2009.
He swore not to run for president but threw his hat in the race when the wife of his exiled rival Ravalomanana declared she would be a candidate.
Both pose a legal problem, since Rajoelina submitted his candidacy after the deadline and Lalao Ravalomanana had not lived in Madagascar six months prior to the nominations, as the election rules require.
Ratsiraka filed his candidacy papers two days after he returned from 11 years of exile in France.
Saturday's court decision did not go down well with the affected candidates' camps.
"We did not expect it at all," said Ravalomanana's aide Mamy Rakotoarivelo.
"It's a bad surprise," said Ange Andrianarisoa from the Ratsiraka camp.
Communication Minister Harry Laurent Rahajason was also "surprised" and said he sensed "trouble".
The three candidates' supporters "will not sit idly. I don't think these cancellations will calm the situation," warned the minister.
Five other candidates have also been struck off the list due to false information and other irregularities on their applications.
All the disqualified aspirants have been given three days to come up with a fresh proposal for their candidacy.
Meanwhile, the electoral commission and United Nations experts in the country are working on setting a new election date.
Elections were due to have taken place on July 24 but have been postponed indefinitely due to the deadlock. – AFP