The Ethiopian military government today ordered the United States to close all of its facilitis here except the embassy and the U.S. AID office and gave the American personnel four days to leave the country.

The surprise announcement gave no reason for the abrupt move, which was accompanied by a sharp attack on the United States, once one of Ethiopia's closest allies. The late Emperor Haile Selassie had used his ties with the United States to "suppress the liberation struggle of the opposed masses," the military rulers said.

The facilities ordered closed were the Kagnew radio communications station in Asmara, the military assistance program, a naval medical research unit and the U.S cultural enter. About a hundred Americans, including 46 officers assigned to the U.S. Military Assistance Advisory Group, were ordered to leave.

The government linked its decision to end the military assistance program directly to Washington's recent decision to halt all grant military aid to Ethiopia because of alleged human-rights violations. The United States has made no decision on a separate Ethiopian request to purchase $45 million in weapons.

(A State Department spokesman said in Washington that the United States had protested the short notice for the closing of the facilities.

(U.S. officials would not discuss the reasons for the Ethiopian decision, but one source in Washington said Ethiopia had been told last week that the United States planned to close Kagnew and to reduce the military advisory group as part of a worldwide cutback.)

After nearly 25 years as Ethiopia's main foreign backer and arms-supplier, the United States is being replaced here with increasing speed by the Soviet Union and Cuba.

The Soviets are providing the new Marxist rulers with between $120 million and $200 million of military equipment, some of which has already begun arriving, and Cuban advisers are expected here any time.

In announcing its decision, the military government, in a broadcast, said that Ethiopia's "anti-imperialist struggle does not allow the existence of organizations that preserve the economic, cultural, political and military interests of any country and weaken the struggle of the oppressed peoples to safeguard their national independence."

The statement denounced the American radio communication station, located in war-torn northern Eritrea Province, as a "means of maintaining American vested interests in the world," particularly in the Middle East, Asia and Africa. It said that to let it continue operating "not only directly contradicts with Ethiopia's guiding ideology of scientific socialism but also opposes its foreign policy of non-alignment."

"The human rights presently prevailing in revolutionary Ethiopia," it said, are "the exalted and glorified human rights of the oppressed masses and not the rotten and fake human rights of the oppressive ruling class."

The existence of an American military assistance program in Ethiopia, it continued, is "useless at a time when the American government, which never spoke of the violation of human rights when the fascist government of Haile Selassie was decimating thousands and thousands of the oppressed Ethiopian people through hunger and inhuman treatment, takes every opportunity to create hatred against revolutionary Ethiopia by depicting it as a country where human rights are violated."

The government statement described the U.S. cultural center as an establishment set up to promote the "cheap culture of imperialists" and said it had been used for years "to suppress the struggle of the broad masses by glorifying and defending the fascistic rule of Haile Selassie."

"This organization only propagates ideas that clash with, dilute and undermine scientific socialism tridot and therefore is of no use to Ethiopia," it added.

The small U.S. naval medical research unit here, which does work on tropical and local disease, it said, was of no service to revolutionary Ethiopia.

With the closure of these American programs and facilities, only the U.S. embassy and the Agency for International Development will be operating here. The agency is providing Ethiopia with about $12 million in economic assistance this fiscal year and was to increase its aid to $20 million in 1978.

The Ethiopian decision to close the Kagnew radio communications station and end the American military advisory mission here marks the premature end of a 25-year-mutual defense and assistance agreement that was to expire next year.

It also raises serious questions about the fate of the Ethiopian government's recent request for more than $45 million worth of ammunition from the United States and of military equipment, including 12 heavy M-60 tanks and eight F-5E jet fighters, that Ethiopia has already bought but that have not yet been delivered.

It appeared that American diplomats here were taken somewhat by surprise by the announcement. There have been persistent reports that the Marxist civilians advising the ruling Provisional Military Council were pushing for just such a move. But it was not anticipated that any action would be taken this weekend.

In May 1953, Washington signed the 25-year mutual defense and assistance agreement with Emperor Haile Selsassie, who was deposed by the military three years ago. The pact provided for U.S. military assistance to Ethiopia to help it with "internal security and legitimate self-defense" against outside threats to its national unity.

In return, the United States was given base rights in Eritrea, where the most serious menace to Ethiopia's unity has existed for the past 16 years as the result of an Arab-backed secessionist movement there.

The Kagnew base, located in the center of Asmara, the provincial capital, at one time employed 3,000 Americans and was the largest U.S. military installation in Africa. Among other things, it monitored radio communications throughout the Middle East.

But in the early 1970s, the Pentagon began phasing it out, and it now has only a small contingent of Americans - 30 or fewer - to operate what is essentially a radio relay facility.

The military advisory group serving with the Ethiopian armed forces has been helping to train the army in the use of the latest American equipment, including M-60 tanks and heavy artillery, and the air force to fly the recently acquired F-5Es. It was scheduled to be reduced considerably in size and role.

The Ethiopian decision to close down the U.S. facilities was preceded by more than two months of almost daily attacks in the state controlled media against the United States and particularly on the U.S. Central Intelligence Agency.

The military government has become convinced that the United States is backing neighboring Arab states that are supporting the Eritrean secessionist movement and the anti-Marxist Ethiopian Democratic Union that seeks the overthrow of the pesent Marxist regime.