A Somali military source has told the BBC that 25 soldiers were killed when a man rigged himself with explosives and detonated himself among soldiers who were queuing up at the Jale Siad College camp.
The military has not made any official comment on the incident.
Forty-eight others were said to have been injured and taken to hospitals in Mogadishu.
The man who blew himself up was wearing a military uniform and entered the camp with a false identity, the military source, who did not want to be named, told the BBC.
Islamist militant group al-Shabab said one of its fighters had carried out the bombing, saying 73 soldiers had been killed and 124 injured.