The United States ordered the Soviet Union today to reduce its staff at its U.N. missions sharply during the next two years, charging that they have habitually engaged in "wrongful" acts, "including espionage."

The order, which U.S. officials acknowledged was unprecedented, requires the Soviets to cut their diplomats and staff, who now total 275 -- by far the largest number of any country at the United Nations -- to 170 by April 1988.

"The U.S. government has long been concerned about the unreasonably large size of the Soviet mission," the American statement said. Despite earlier warnings, it said, "Soviet U.N. missions have continued to engage in activities unrelated to U.N. business, including espionage."

There was no immediate Soviet reaction to the announcement, but the U.S. statement said the decision "need not have a negative impact on bilateral relations."

"We're not saying it won't have an impact," one American at the United Nations said, "just that it need not, because it is totally justifiable." U.S. spokesmen here said it was not inconsistent with American obligations as the host of the United Nations or with international law.

The unexpected announcement comes as U.S.-Soviet relations appeared to be cooling from the warmth generated by the summit meeting in Geneva last November between President Reagan and Soviet leader Mikhail Gorbachev.

While the two had agreed in Geneva to an exchange of visits to each other's capitals this year and next, they have been unable since to agree on a date for the initial visit, by Gorbachev to Washington. In sharp language on Wednesday, Reagan said that if the Gorbachev trip is not satisfactorily arranged, he would not go to Moscow next year.

Today's U.S. directive affects diplomats and staffs of the Soviet mission and also those of the Ukraine and Byelorussia, two Soviet republics that were given separate seats under a 1945 agreement as a compromise measure to ease Moscow's fear of isolation.

The combined Soviet delegation is more than twice as large as either of the next two -- those of the United States, which has 126, and China, which has 116.

U.S. officials said there was no particular reason for the timing of the move and that it was not a response to immediate security needs.

They said the last public accusation of espionage against a Soviet U.N. diplomat came in 1983, and although investigations are pending on Soviets who "continue to engage in clandestine activities," they were not the motive for today's action.

The announcement came with awkward timing for Moscow. The Soviet Communist Party has just completed its congress, and the Soviet embassies in both Washington and the United Nations are headed temporarily by low-level officials as they await the appointment of new ambassadors.

U.S. Ambassador Herbert Okun called on the Soviet deputy representative here, Vasiliy Safronchuk, this morning to break the news in what U.S. spokesmen characterized as a "serious and sober discussion of the matter."

One American reported that Safronchuk listened stonily and did not react. Junior-level Soviet diplomats at the United Nations said they were aware of the edict, but they refused to offer any reaction.

U.N. Secretary General Javier Perez de Cuellar, who was also informed by Okun, said only that his legal counsel was studying the issue to see whether it conformed to agreements governing U.S. responsibilities as host country to the United Nations.

The United States contended that neither the 1947 Headquarters Agreement between the United Nations and the United States nor other international treaties deal explicitly with the size of diplomatic missions but that they do give the host country the right to protect its security.

Washington has long contended that a high proportion of diplomats and U.N. staff members from the Soviet Bloc are espionage professionals. Arkady Shevchenko, a Soviet diplomat who defected to the United States while serving as a U.N. undersecretary, has estimated that more than one-third do at least some spying.

The United States has long restricted Soviet diplomats to a 25-mile radius of New York City, and last year it extended that ban to U.N. staffers from the Soviet Union and seven other countries.

Even after the cuts ordered today, the U.S. statement said, the Soviet mission -- which includes support staff ranging from drivers to security officers -- will remain the largest of any country at the United Nations and will suffice for diplomatic business, "given an objective assessment" of staffing needs.

If Moscow rejects the edict, the U.S. statement said, "we will only issue visas up to the permitted ceiling."

U.S. officials added that no similar cutback was envisioned for other missions, but they warned that if Soviet allies suddenly increased their staffs to compensate for the Soviet cuts, they could be subjected to the same rules.