Residents searching through destroyed houses found the bodies near the Black Sea district of southern Mogadishu, where heavy fighting between Ethiopian forces and armed men erupted on Thursday.
"It was a very gruesome scene. They indiscriminately shot innocent civilians who were fleeing the fighting," Ali Muse Mohamed, a local elder, said referring to Ethiopian soldiers.
Osman Keysaney, another resident, said some of the civilians whose bodies were found in the Black Sea district had gunshot wounds to the head.
"They shot any moving creature around the neighbourhood," Hassan Sugule, another elder, said.
"They also killed children."
The body of an Ethiopian soldier was dragged on the streets by civilians on Thursday. This sparked 'reprisal' attacks by Ethiopian forces the following day.
The UN condemned the dragging of corpses through the streets of Mogadishu.
"These gross violations of humanitarian law as well as barbaric and inhuman acts have triggered new panic and movements of population," the UN Office for the Coordination of Humanitarian Affairs (OCHA) said in a statement.
"Somalia is facing one of the worst humanitarian crises in years and coping mechanisms of the population are stretched to the limit."
A Somali medic said over 250 civilians had been wounded in the fighting.
Hospitals are overflowing with patients and doctors have said there is insufficient medicine, beds and space for the wounded.
On Friday, Ethiopian forces shelled suspected hideouts of armed groups in Mogadishu's southern districts in a bid to end months of attacks aimed against them by the groups.
Ethiopian forces fought alongside the Somali government last year to drive out the Islamic Courts Union (ICU) group that briefly controlled large parts of the country and sought to impose Islamic law.
Although the ICU was removed earlier this year, its remnants and allied tribes have since waged a guerrilla war targeting government officials, Ethiopian troops and African Union peacekeepers.
The UN said on Friday that 114,000 more Somalis had been displaced by fighting in the last week, bringing to 850,000 the number of internally displaced across the nation.