Mr Museveni won almost 59% of the vote, with Bobi Wine trailing with about 35%, the Electoral Commission said.
Thursday’s poll may turn out to be the “most cheating-free” in the history of the African nation, the president said.
Bobi Wine, a former pop star, vowed to provide evidence of vote-rigging when internet connections were restored.
The government shut down the internet ahead of voting day, a move condemned by election monitors.
They said confidence in the count had been damaged by the days-long cut. A government minister told the BBC on Saturday evening that the internet service would be restored “very soon”.
In a phone interview with the BBC World Service, Bobi Wine said he and his wife were not being allowed to leave their home by soldiers.
“Nobody is allowed to leave or come into our house. Also, all journalists – local and international – have been blocked from accessing me here at home,” he said.
Dozens of people were killed during violence in the run-up to the election. Opposition politicians have also accused the government of harassment.
The result gives President Museveni a sixth term in office. The 76-year-old, in power since 1986, says he represents stability in the country.
Meanwhile, Bobi Wine – the stage name for 38-year-old Robert Kyagulanyi – says he has the backing of the youth in one of the world’s youngest nations, where the median age is 16.
“The electoral commission declares Yoweri Museveni… elected President of the Republic of Uganda,” election commission chairman Justice Simon Mugenyi Byabakama said on Saturday.
He said turnout was 57% of the almost 18 million registered voters. (Courtesy BBC)