At least 15 dead in suicide bombing at Somalia army camp
"I have counted about 15 new recruits who have been killed in the blast," said army officer Mohamed Adan, adding the toll could be higher.
Adan said the bomber was disguised among recruits queueing up outside the General Dhegobadan Military Camp when the explosion occurred.
There was no immediate claim of responsibility for the attack, the deadliest in the capital for 18 months.
Soldiers and military facilities are common targets for Al-Shabaab, an al-Qaeda-aligned jihadist group fighting to overthrow the internationally-backed government in Mogadishu.
Hotels and security checkpoints are also commonly attacked.
In December 2019, 81 people were killed by a suicide car bomber at a checkpoint in the city centre, while the last major assault on a hotel killed 11 in August 2020.
Somalia has been mired in interlocking crises for the last three decades, with repeated bouts of civil war, clan conflict, Islamist insurgency, famine and political instability.
Al-Shabaab rose to prominence in 2006. Despite the long deployment of African Union peacekeepers it remains a potent force even though it has lost much of the territory it once controlled.