The Spanish government has asked the U.S. Embassy here to send home two diplomats following allegations that they were involved in espionage activities.

Prime Minister Felipe Gonzalez confirmed press reports of the expulsions, saying, "It is true that a request was made for them to leave the national territory."

Gonzalez did not name the diplomats and did not specify the nature of their alleged spying. He said they had been asked to leave because their activities "did not correspond to their diplomatic function."

The press accounts said the U.S. diplomats had left the country in the first week of February, but this could not be confirmed.

Reliable sources said the diplomats were believed to have been investigating the reexport from Spain to Soviet Bloc countries of imported U.S. technology that had military as well as civilian uses.

The expulsion reports were headlined in the influential Madrid daily El Pais and in the conservative Madrid newspaper ABC. Both said that the diplomats had been expelled for spying on "official Spanish institutions" but named different embassy officers.

It was the first time that U.S. diplomats in Spain have been reported expelled for alleged espionage activities.

A subsequent report by the official news agency EFE coincided with the El Pais report. Both reports said that one of the diplomats was assigned to the Spanish-U.S. Air Force base at Torrejon, near Madrid, and that the other was assigned to the embassy's political section.

In Washington, the State Department had no comment on the expulsions.

Requests to speak to the officers named in the press reports were referred to the embassy's spokesman, who refused to comment on the subject.

The reports jolted political circles here as Spain is a NATO member and has maintained a bilateral defense and cooperation agreement with the United States since 1953. The agreement allows for the joint use of four bases in Spain.

Cooperation between the Spanish and U.S. intelligence agencies has been very close in the past. The Spanish agency, the Center for Information and Documentation Services, known by its Spanish initials as CESID, is derided by its critics as a subsidiary of the CIA.

The EFE news agency quoted sources close to CESID in its report, which said the U.S. diplomats were discovered by officers of the Spanish agency to be photographing communications equipment in Madrid that linked Spain's security services to senior government offices.

While there had been no known case of a U.S. or western diplomat being expelled from Spain, there have been 13 reported instances of Soviet citizens being asked to leave since the start of diplomatic relations betwen Moscow and Madrid in 1977.

The issue of "dual use" advanced technology convertible from civilian to military use has recently come to the forefront as an irritant in U.S.-Spanish relations. The United States has been urging Spain to join a Paris-based organization known as Cocom -- the Coordinating Committee for Multilateral Export Controls -- which groups most NATO nations and Japan with the purpose of preventing such "dual use" technology from reaching Warsaw Pact nations.

Spain, while a NATO member, has so far refused to clarify its status within the western alliance and Spain's Socialist government is officially committed to holding a referendum next year on whether to withdraw from NATO. The Spanish government has resisted suggestions that it join Cocom, saying it is awaiting the results of the referendum.

A U.S. deputy assistant secretary of state for European affairs, James F. Dobbins, discussed the Cocom dispute this week with Spanish officials in Madrid. The United States, Dobbins later told a press conference, was "open to a variety of ways to solving this problem."

Spanish business circles fear that the Cocom issue could lead to the blocking by Washington of a $200 million deal between American Telephone & Telegraph Co. and Spain's national telephone monopoly to build a semiconductor manufacturing plant near Madrid.

U.S. officials are particularly concerned that sensitive U.S. technology imported to Spain has shown up in Soviet Bloc countries such as Cuba and Bulgaria. At least 10 Spanish high-technology companies have been blacklisted by Washington and barred from potential "dual use" imports.

Another issue that has upset Spanish-U.S. relations has been a recent report that American contingency defense plans had earmarked Spain, among other countries, for stockpiling nuclear weapons in an emergency.

The report, which received prominent display here, prompted an angry statement by the Spanish Foreign Ministry. "At no time," the ministry said, "have the American authorities notified the Spanish government of the existence of these plans nor have they sought consultations on this subject."

A statement issued by the U.S. Embassy said that "no weapons would be deployed in another country without the approval" of that government or without being strictly in accordance with the plans of NATO.