Ethiopia expelled West Germany's ambassador yesterday, in apparent retaliation for Bonn's grant of $11.8 million in credits to Somalia which Ethiopia feared might be used to buy weapons.

West Germany said it was understood the funds would not be used to buy arms, but the fact that the credits were unconditional led some diplomats to believe that the aid would be used to help defray military costs of Somalia's six-month war with Ethiopia in the Ogaden region.

Since the government of President Mohammed Siad Barre expelled Soviet military advisors and refused further Soviet aid last year, Somalia has been looking for a new source of arms. West Germany has been mentioned as a possible source since Somalia permitted a German commando raid to rescue hostages from a hijacked airliner in Mogadisha late last year.

Ethiopia, which broke off its military ties with the United States some time ago, has recently been receiving large arms deliveries from Moscow.

In a related development, West Germany joined Italy, Great Britain, France and the United States in a discussion of the tensions in the Horn of Africa in Washington Saturday. The five of nations announced their backing for mediation efforts by the Organization of African Unity.