Museveni said in a national address telecast live that the lockdown will last 21 days.
According to the measures, movement in and out of the two districts is prohibited. The two districts have also been placed under a night curfew with only cargo vehicles allowed to exit.
Public gatherings have been prohibited including places of worship and entertainment centers.
Schools will remain open but under strict supervision by district medical teams.
Mubende was the epicenter of the Ebola virus disease outbreak after the index case was announced on Sept. 20.
The country currently has 58 confirmed cases of Ebola, with 19 deaths, and 20 people have recovered since the index case was reported, according to government data.