Ethiopia has warned the United States that it is prepared to take "any and all measures" to defend itself, including measures in the military field, in response to the "threat" which would be created by the proposed U.S military installation in next-door Somalia, Ethiopian Foreign Minister Felleke Gedle Giorgis said yesterday.

Giorgis would not specify possible Ethiopian responses, but he appeared to be hinting broadly at military action against Somalia. The minister did say in an interview that if the United States goes ahead with its planned military links to Somalia, Ethiopia will be forced to turn from national development to military mobilization.

Saying that he had delivered the same warnings to Secretary of State Edmund S. Muskie last week at the United Nations, Giorgis charged in an interview that the proposed U.S. facilities are "a direct threat to our independence" because they will internationalize the age-old conflict between Somalia and Ethiopia.

"This can involve the United States in an endless war in Africa . . . That might take place if we feel we are threatened, and indeed we feel we are threatened," he added.

On Aug. 22, the U.S and Somalia signed agreements permitting American military use of Somali air and naval installations in return for $45 million in U.S. aid and military credit sales over two years. Last week the House Appropriations subcommittee on foreign operations, which earlier had objected to the plan, said it would approve the first $20 million in military credit sales if the Carter administration provides "verified assurance" that Somali regular forces are no longer present in Ethiopia.

The Somali facilities agreement is part of the U.S. program of upgrading its military presence near the Persian Gulf. Similar agreements have also been reached with Kenya and Oman, but these are less controversial than the pact with Somalia.

The Ethiopian official charged that "tens of thousand" of Somali regular troops are still inside Ethiopian territory carrying on a war that has continued without interruption for the past 20 years. "we are still in a state of war," he declared.

Asked about Soviet and Cuban military personnel and aid in Ethiopia, which is governed by a revolutionary Marxist regime, Giorgis said there is "no base whatsoever" by those countries in Ethiopia. He said "they came to our defense at a time when we were in a critical position" due to a Somali invasion in 1977. He said the Russians and Cubans will remain "as long as we are threatened."

U.S. estimates are that several hundred Soviet military advisers and about 13,000 Cuban troops are stationed in Ethiopia. Giorgis refused to specify a number.

Asked about two Cuban soldiers who recently took refuge in the U.S. Embassy in Addis Ababa, Giorgis said his government demanded that they be turned over to its refugee bureau to determine whether they are "genuine refugees" or were forced into the embassy. "If they are genuine refugees, they can go wherever they wish," he said.