The claim of responsibility was made by the group's spokesman Sheikh Ali Mohamud Rage in an audio post on pro-al-Shabab websites. Al-Shabab, which is allied to al-Qaida, carries out frequent bombings in the capital.
Rage said the bombing targeted a "hostile Turkish convoy" near a busy checkpoint at an entrance to the city. Two Turkish brothers were among the dead and Turkish President Recep Tayyip Erdogan condemned the attack, the second worst bombing in Somalia's history.
The explosion came at rush hour Saturday as Somalia returned to work after its weekend. Most of those killed were university and other students returning to class. Somalis mourned the deaths of so many young people in a country trying to rebuild itself after decades of conflict.
At least 125 people were wounded and hundreds of Mogadishu residents donated blood in response to desperate appeals.
Some analysts had said that al-Shabab would not claim responsibility for the bomb, as it would make the rebels unpopular with Somalis who want peace and stability.
Somalia's worst bombing killed more than 500 people in Mogadishu in October 2017. It is widely suspected that al-Shabab carried out that bombing but did not claim responsibility because of widespread public anger over the carnage.
Al-Shabab is now able to make its own explosives, its "weapon of choice," United Nations experts monitoring sanctions on Somalia said earlier this year. The group had previously relied on military-grade explosives captured during assaults on an African Union peacekeeping force.
The attack raises concern about the readiness of Somali forces to take over responsibility for the Horn of Africa country's security in the coming months from the multinational African Union force.
Years of conflict and al-Shabab attacks, along with famine, shattered Somalia, which is home to more than 12 million people.
The Horn of Africa nation has been trying to rebuild since establishing its first functioning transitional government in 2012. Al-Shabab was pushed out of the capital, Mogadishu, and other major cities several years ago by the regional African force but still carries out suicide attacks across Somalia.
END/AP/UNB/MT