The Soviet Union and Ethiopia yesterday disclosed a mutual pledge to collaborate in military, political and economic matters for the next 20 years under terms of a "friendship and cooperation" treaty completed Monday in the Kremlin.

The accord, signed by Soviet President Leonid Brezhnev and Ethiopian leader Mengistu Haile Mariam, calls for joint consultations between the two nations "in the event of situations which constitute a threat to, or a breach of, international peace."

The Kremlin thus has conferred upon Ethiopia the same treaty status as that once enjoyed by Addis Ababa's enemy in the horn of Africa, President Mohammed Siad Barre, abrogated a similar friendship treaty a year ago while fighting for control of Ethiopia's Ogaden Desert, which the Somalis claim.

The treaty with the Ethiopians falls short of pledging mutual military assistance but calls for cooperation "in the interests of ensuring the defense capabilities" of the two-countries. A mutual military pledge, according to knowledgeable Western diplomats, could have provided, in Soviet eyes, an international legal basis for bases in Ethiopia. The Somalis' action last year effectively barred the Soviets from using the important Gulf of Aden port of Berbera, from which it would be possible to interdict Persian Gulf oil supply routes.

At the same time, the accord intensifies the Soviet-Ethiopian military relationship, which has existed since Mengista's government established a Marxist line following the overthrow of pro-Western Emperor Haile Selassi.

A massive airlift of Soviet and Cuban military aid broke the Somali Ogaden campaign and the Soviets and Cubans are now reliably reported to be directing Ethiopian efforts at quelling the Eritrean insurgency, now in its second decade.