The law which was introduced last year means that anyone insulting President Paul Kagame faces between five and seven years in prison.
Lawyer Richard Mugisha had argued that the law was unconstitutional as it undermined freedom of expression. The court ruled that it should remain due to the responsibility that the office holds.
The same court ruled that a law which prohibits writing articles or drawing cartoons that humiliate MPs, ministers or other government officials should be annulled.
Mr Mugisha had also argued that articles which criminalised adultery should be scrapped. The court rejected that appeal.