President Emmerson Mnangagwa’s win in last month’s polls has been upheld by Zimbabwe’s Constitutional Court.
The opposition MDC Alliance had brought the legal challenge saying the vote was marred by “mammoth theft and fraud”, but this was rejected by the court.
Delivering the verdict, Chief Justice Luke Malaba called allegations of tampering “bold and unsubstantiated”.
It was Zimbabwe’s first election since long-time leader Robert Mugabe was ousted from power last year.
Two days after the vote, at least six people were killed in clashes between the army and MDC Alliance supporters, who alleged that party leader Nelson Chamisa had been robbed of victory.
Ahead of the court ruling, the streets around the courthouse in the capital, Harare, were cordoned off by security forces.
The BBC’s Shignai Nyoka in Harare says that the city’s roads are mostly empty.
In a unanimous judgement, the nine judges ruled against the opposition’s petition because they said it did not include sufficient evidence.
“The best evidence would have been the contents of the ballot boxes themselves,” Chief Justice Malaba said.
He also dismissed as “startling” the MDC Alliance’s claim that an official revision of the vote share was itself proof of irregularities.
President Emmerson Mnangagwa narrowly avoided a second-round run-off when he took 50.7% of the vote. Zec, the electoral commission, had revised this figure from the 50.8% it originally released.
Chief Justice Malaba said the body had “complied with prescribed procedures” when it announced the change.
The president has tweeted that he was “not surprised” by the Constitutional Court’s ruling.
He said he was calling “for peace and unity above all” and that his “door is open” to his opposition rival who brought the legal challenge.
But his tweets included criticism of the opposition MDC Alliance, accusing it of instigating “wholly unnecessary violent protests” after the 30 July polls.
A group of 27 opposition activists have been charged with inciting public violence but maintain their innocence.
The US has criticised the detention of, and “abuses” against, opposition supporters, in particular expressing concern for the “physical safety” of key opposition figure Tendai Biti who was arrested in connection with the post-election violence.