“We have initial reports that at least three people, including the bomber, were killed and six others injured in the explosion,” said police spokesman Abdulahi Hasan Barise.
The president’s whereabouts were not immediately clear.
No one had yet claimed responsibility for the attack. The extremist Shebab rebels fighting the Western-backed Somali government have resorted to suicide and grenade attacks since abandoning bases in Mogadishu in August.
Sharif’s government is propped up by a 10,000-strong African Union force comprising troops from Djibouti, Burundi and Uganda.