At least 74 people were killed in blasts targeting people watching the World Cup.
The Somali Islamist group al-Shabab said it was behind the attacks because Uganda supports Somalia’s government.
An US administration official said al-Qaeda was racist and used black Africans as “cannon fodder”.
In an interview on South African television, Mr Obama said: “What you’ve seen in some of the statements that have been made by these terrorist organisations is that they do not regard African life as valuable in and of itself.
“They see it as a potential place where you can carry out ideological battles that kill innocents, without regard to long-term consequences, for their short-term tactical gains.”
An administration official went further, saying that the Ugandan attacks show that “al-Qaeda is a racist organisation that treats black Africans like cannon fodder and does not value human life”.
In his interview Mr Obama said it was both tragic and ironic that the blasts had taken place while people were celebrating the success of a World Cup staged in South Africa.
“On the one hand, you have a vision of an Africa on the move, an Africa that is unified, an Africa that is modernising and creating opportunities, and on the other hand, you’ve got a vision of al-Qaeda and al-Shabab that is about destruction and death.”
About 5,000 African Union troops from Uganda and Burundi are based in Mogadishu, propping up the fragile interim government.
The Amisom force is engaged in frequent firefights with the Islamist insurgents who control much of southern and central Somalia.
Both Burundi and Kenya, which helps with training for the Somali interim government, have stepped up security.