The social media giant said a network connected with the ministry of information had been using fake and duplicate accounts to impersonate users and boost the popularity of posts.
In a BBC interview, the government accused Facebook of being biased.
The run-up to the election has been marred by tension and violence.
After 35 years in power, President Yoweri Museveni, 76, is being strongly challenged by music star Bobi Wine, who is 38 and draws much of his support from young people.
Bobi Wine has been detained periodically, and dozens of opposition protesters have been killed.
Campaigning has been banned in the capital, Kampala, and several other districts. The opposition says this is because it is popular in those areas, but the government says the measure is due to Covid-19 restrictions.
"We found this network to be linked to the government Citizens Interaction Center at the Ministry of Information and Communications Technology in Uganda," Facebook said in a statement.
"They used fake and duplicate accounts to manage pages, comment on other people's content, impersonate users, re-share posts in groups to make them appear more popular than they were," the statement continued.