It upheld a constitutional amendment, approved by parliament in December, to scrap the presidential age limit of 75.
Mr. Museveni, who is 73, has led Uganda for more than 30 years been in power since 1986.
One of the judges said that citizens still had the power to vote him out.
It is not yet clear whether President Museveni will seek re-election in 2021.
There was formerly a limit of two five-year presidential terms but this was removed by parliament in 2005.