The blast sent a plume of smoke above a busy part of Mogadishu during the morning rush hour and shredded part of the school.
Most of those killed were students returning to class.
Somali forces ended an all-night siege on a hotel in the southern port city of Kismayo on Saturday morning.
The attacker had explosives strapped to his body and infiltrated the General Kahiye Police Training Academy during an early morning parade, police said.
Islamist militants al Shabaab claimed responsibility for this weekend’s attack.
A bomb attack in Mogadishu killed at least 358 people this month.
The deadliest attack since the Islamist insurgency began in the country.
Al Shabab militants launched a deadly attack in the country's capital.