It alleged that Barrow or members of his National People's Party had offered villagers cash or gifts for votes and infiltrated the electoral commission.
Barrow's first election in 2016 put an end to more than 20 years of dictatorship in the tiny West African nation under Yahya Jammeh.
Chief Justice Hassan Darboe Jallow ruled that the UDP had not complied with rules requiring it to provide a security deposit when filing the complaint.
The Gambia's Supreme Court on Tuesday dismissed a plea by the country's main opposition to annul the outcome of the December 4 presidential elections, in which incumbent Adama Barrow was declared victor.
The United Democratic Party (UDP) of political veteran Ousainou Darboe said the election campaign had been tainted by corruption and bribery.
It alleged that Barrow or members of his National People's Party had offered villagers cash or gifts for votes and infiltrated the electoral commission.
It also charged that foreign nationals had illegally cast ballots, and that voting and the vote count itself were marred by irregularities.
Barrow's first election in 2016 put an end to more than 20 years of dictatorship in the tiny West African nation under Yahya Jammeh.
Official results gave Barrow, a former property developer, 53 percent of the vote against Darboe's 27 percent.
But even before they were published Darboe said he would file an objection, although he did not specify the reason.Â
His party filed suit on December 6.
Chief Justice Hassan Darboe Jallow ruled that the UDP had not complied with rules requiring it to provide a security deposit when filing the complaint.
It had also failed to meet a requirement to advise Barrow of the complaint within five days of filing the suit, he said.Â
The decision by the Supreme Court cannot be appealed.
"We have not lost anything, because the petition was not dismissed based on merit but a mere technicality," Darboe said in response to the verdict.
"We should be proud of ourselves for what we have done and will continue to do for (our) country," he said in a statement on his party's website.
The vote marked the first election in The Gambia, a former British colony of two million people, since Jammeh fled into exile in January 2017 after his surprise defeat at the ballot box.Â
He ruled for 22 years, presiding over a regime accused of a litany abuses, including death squads and torture.Â
The United States has given its approval to the December 4 vote.
It says that US and other observers had noted "some minor procedural irregularities" but the election was otherwise "free and fair."
The European Union's observer mission said The Gambia had made "democratic headway" as shown by "wide voter participation and citizen engagement."
Both the EU and US are pushing for The Gambia to enact wide-ranging electoral reform.
Barrow has promised to set term limits and for presidents to be elected by an absolute majority rather than through the current first-past-the-post system.