Speaking from the AU headquarters in Ethiopia, El-Ghassim Wane, an AU spokesman, said that the attackers "have no care for Somalia and their sole aim is to destroy and bring about more violence to the country".
Sheik Muktar Robow Mansoor, a spokesman for al-Shabab, said that a bomber wearing a jacket with explosives had detonated his charge near the compound and that another in a car had set off his device at the gate to the AU base.
"Our fighters have carried out two suicide attacks on the infidels in Mogadishu, inflicting heavy losses," Mansoor said.
The AU had initially reported the attack had been by mortar.
Colonel Adlophe Manirakiza, from the AU, confirmed that the blast was "a suicide attack" at the camp.
The AFP news agency reported Ali Mohamed, a witness, as saying he saw a car entering the Burundian camp, the site of the former Somalia National University.
"Minutes later, there was a huge explosion," he said.
Omar Hashi Aden, Somalia's internal security minister, said the government would "respond very quickly to this cruel attack".
"We are ready to listen to suggestions, but we will not tolerate violence against these troops. We need them to assist us to train our security forces and rebuild the country," he said.
The attack comes as Somalia's new government takes over in the face of threats from opposition forces.
Mohammed Adow, Al Jazeera's correspondent in Nairobi, the Kenyan capital, said: "Many people take this to be their [al-Shabab's] opposition to the government ... [which] is for keeping the peacekeepers in Somalia until things get better on the ground.
"But al-Shabab ... want legitimacy and many feel that by targeting the peacekeepers they are seeking legitimacy and a continued reason to fight," he said.
Adow said that al-Shabab would not accept a government that does not institute sharia law.
The 53-member AU maintains a 3,400 strong peacekeeping force in Somalia made up of Burundian and Ugandan troops, while it awaits contributions of about 4,600 troops from other nations.