European Community foreign ministers "knew nothing at all" about the pending U.S. military attack against Libya when they met here yesterday to discuss joint European action in response to Libyan involvement in terrorism, a spokesman for the government of the Netherlands said early today.

The spokesman for Foreign Minister Hans van den Broek, who currently holds the EC presidency, said the Europeans had been pleased at adopting a joint condemnation of Libya during yesterday's session and had hoped it would lessen the possibility of military action in the Mediterranean.

One European official called the U.S. raids "a slap in the face for Europe."

In London, however, Foreign Office officials said that "we and the Americans have been in the closest contact over the last few days" and strongly implied that Britain had advance knowledge of the attack.

"As far as Britain is concerned," a spokesman in London, reached by telephone, said, "we are very satisfied with the level of consultation between ourselves and the Americans . . . and with the rest of Europe."

[Secretary of State George P. Shultz said in Washington that the EC meeting had not been apprised of the planned U.S. raids but he said that "some governments" within the EC had been made aware of it. U.S. officials indicated that Britain was among these.]

As officials throughout Europe were awakened after midnight with news that the raid had taken place, it remained largely unclear who knew what and when.

In a statement released here last night following a five-hour emergency meeting, the EC foreign ministers declared that Libya was "clearly implicated in supporting terrorism" and they agreed to reduce and restrict Libyan diplomatic missions in their countries.

The EC states agreed to impose stricter visa requirements on Libyans, and said they would "meet with a vigorous and appropriate response" any direct threats and acts of violence against Europe.

In a final paragraph, however, the statement called for "restraint on all sides" to achieve a "political solution . . . avoiding further escalation of military tension in the region." Van den Broek said the appeal was meant for "all pertinent parties . . . including the United States."

The statement fell short of a British proposal that the other 11 follow its example and sever diplomatic ties with the government of Libyan leader Muammar Qaddafi, but a wide range of European officials had expressed the hope that their action would forestall any U.S. military action against Libya.

But according to one U.S. official closely monitoring the European response to Reagan administration calls for action against Libya, "it should be enough" to convince Washington that Western Europe is concerned about the Libyan threat, "at least for the next two or three weeks."

Impetus for yesterday's declaration had come from widespread European apprehension over a possible U.S. military strike against Libya. Sources from various community governments, speaking after adoption of the declaration but before the U.S. raids, said they hoped that possibility had been forestalled.

"It was crucial that the 12 responded credibly, coherently and with a state of urgency," British Foreign Secretary Geoffrey Howe said in a news conference after the statement was approved. "Both sides of the Atlantic expect nothing less."

Van den Broek called it a "very firm and strong stand against terrorism." He said the community hoped that "the American public will be convinced we take this issue seriously."

The declaration goes further than previous EC condemnations of terrorism in mentioning Libya by name, something that the ministers avoided during a meeting on the subject last January. The statement, which also refers to unnamed "other states clearly implicated in supporting terrorism," gave no indication as to when the restrictions on Libyan diplomatic missions would take effect, or how many Libyans would be affected.

"We realize that the sizes of Libyan representations in European capitals are quite different" from country to country, Van den Broek said. He said that "harmonization" of plans by various governments would be discussed by a special EC committee on terrorism, and that they could take effect within "days or weeks."

With the exception of Britain, which broke relations with Libya in 1984 after the killing of a British policewoman by a shot fired from inside the Libyan Embassy in London, all EC members maintain full diplomatic ties with Tripoli.

The statement represents a compromise between governments such as Britain and the Netherlands that advocated a tougher line against Qaddafi and those including Greece, Italy, Spain and West Germany that to varying degrees question the weight of evidence against him or believe that singling out Libya for blame for a series of recent terrorist attacks is misleading and counterproductive.

European concern that a U.S. attack was imminent was heightened last week as American warships headed toward the Libyan coast. Over the weekend, U.S. officials carefully left open the possibility of retaliation for Libyan involvement in the April 5 bombing of a West Berlin discotheque in which two persons were killed, including a U.S. serviceman, and hundreds injured.

At the same time, Reagan sent Vernon Walters, the chief U.S. emissary to the United Nations, on a whirlwind tour of European capitals -- including London, Madrid, Bonn, Paris and Rome -- to explain the American case against Libya and press for sterner measures against the Qaddafi regime.

When they met last January following terrorist attacks at airports in Rome and Vienna, the EC ministers declined to support U.S. calls for sanctions against Libya. Following a heated debate, they issued a declaration saying that "states that favor or protect terrorists cannot expect indulgence nor can they expect to have normal relations" with the community, and they said they would not sell arms to such countries. But Libya was not mentioned.

European officials said yesterday that their increased willingness to crack down on Libya was a reflection of their own assessments of Qaddafi's involvement in terrorism and the threat it poses to them, as well as pressure from the United States.

"Most of the victims of terrorism have fallen in Europe," Van den Broek said. "That is sufficient reason for us to be extremely alarmed."

A British official, who said his government presented the hardest line during the meeting, said Howe told his colleagues that "if you are concerned about the possibility of an American military attack, the Europeans must be able to show a commitment to alternative means.

"Nobody in London would be surprised at U.S. military action," the official quoted Howe as saying, "if the Europeans are not prepared to take action."

Howe said Britain was absolutely convinced of Libyan involvement in the West Berlin bombing, and he called for a three-part "action plan" including breaking diplomatic relations, imposing stricter immigration controls that would admit Libyan citizens to Europe only on "medical or humanitarian grounds," and a reaffirmation of the points made in the January declaration that would mention Libya by name.

The latter two points were agreed without undue difficulty, sources said. An initial draft drawn up by the Netherlands called for at least threatening to break diplomatic relations if there were any further Libyan provocation, but most governments were opposed.

West German Foreign Minister Hans Dietrich Genscher argued that evidence of direct Libyan involvement in recent terrorist acts was "not sufficient" to justify the complete closing of Libyan missions in Europe.