The Reagan administration, responding to the latest terrorist attack on Americans in Europe, is asking European governments to expel Libyan diplomats and agents, informed sources said today.

The request came as administration officials accused Libyan leader Muammar Qaddafi of launching a "master plan" for indiscriminate violence against Americans in Europe and the Middle East.

The administration appeared to be laying groundwork for possible military retaliation against Libya following the bombing of a West Berlin discotheque that killed two people, including one American serviceman, and injured at least 150 more, about 60 of them Americans.

Officials said the United States is in better position to justify a retaliatory strike than in the past because evidence is in hand about Qaddafi's "master plan" for terrorist attacks. However, officials said no decision on retaliation has been made.

One official said the administration was seeking today to "point the finger" at Qaddafi, while stopping short of pinning the blame on him for the Berlin attack or the bombing of TWA Flight 840 last week.

"Our patience is wearing thin on a number of these incidents and, as I say, there is a pattern that is worldwide," another official said. "If we do tie him in, we will hold Qaddafi responsible. . . . "

Spokesman Larry Speakes said Reagan is "deeply concerned about the increasing number of terrorist incidents that are affecting Americans in Europe and worldwide." Reagan, who returns to Washington Sunday, again vowed to "do everything possible" to apprehend and prosecute those responsible, while cooperating with allies to prevent such incidents, Speakes said.

An administration official said the United States is aware of Libyan threats directed at 30 American installations in Europe and the Middle East, and an unspecified number of diplomats and other Americans, since early this year.

Sources said attempts have been made by Qaddafi's top agents to "smoke out" the identity of Central Intelligence Agency agents. For example, according to one source, suspicions were raised recently when strangers walked into U.S. embassies in Europe promising to provide information to the CIA and asking where they could talk to a CIA agent.

"The master plan is that these 30 or so installations and a number of diplomats have been targets," said the administration official, who cannot be identified. "So we are seeking the footprints of the Qaddafi terrorist plan all over the Middle East and in Europe."

The official said U.S. intelligence sources picked up information that Libyans were "attempting to stake out" American installations, "figure out how they operated, learn how to get inside of them or learn who is operating from them or target people we have abroad. . . . "

The official said the United States knows of Qaddafi agents operating under his orders in European capitals, while other terrorist groups are "free-lancing" or "operating in a climate" encouraged by Qaddafi.

In the administration, the official said, there is "a consensus" that attacks "do fit a pattern. It seems to be an idea of indiscriminate violence, that you strike out at Americans but whoever else is killed or injured does not matter.

"We believe this vindicates what we have been saying, that there is a pattern, that there is a master plan that is being instigated in many cases. . . by Qaddafi. We are seeing this time and again." Asked about the Berlin attack, the official said, "The pattern particularly of the discotheque, the La Belle incident, is strikingly similar to the type of indiscriminate attacks" that Qaddafi has used.

Three groups or individuals said they were responsible for the Berlin attack, none with known ties to Libya. News organizations in Europe received phone calls that claimed a West German leftist terrorist group carried out the bombing, another call saying that a radical Arab group was responsible and a third said the Red Army Faction, one of Western Europe's most notorious leftist gangs, was responsible.

The TWA bombing last week, which killed four Americans, "did not seem" at first to be similar, the official added. "But then again, clearly he was trying to wreck the whole plane. So I don't know. . . . The evidence is just not that far."

In the past, the administration has often been paralyzed by internal disagreement on whether to retaliate for terrorist attacks. But officials said these divisions over use of military force, often pitting the State Department against the Defense Department, were not as evident in the planning of the U.S. naval exercises in the Gulf of Sidra that led to a military confrontation.

The official cited as the administration's current policy a 1984 speech by Secretary of State George P. Shultz in which he said that in some cases the American people would have to be prepared for civilian casualties inflicted by the United States in retaliatory strikes aimed at terrorists.

Reagan has said he did not want to retaliate where it could cost innocent lives and that retaliation must be against the perpetrators of terrorism, if they can be found.

It was understood that the request to U.S. allies to expel Libyans would be conveyed through private diplomatic channels. One official said the request would cover both Libyan diplomats and others known to be agents for Qaddafi. It was not known how the Europeans would react, but officials pointed to the French decision to expel two members of the Libyan "People's Bureau" this week for plotting terrorist acts against Americans.

The official added that all nations are affected by the violence ". . . And all nations have to work to do something about it. And one of those ways is the Libyan people's bureaus, which are located in a number of European capitals. . . . We have got to go to the people that are causing these problems."

The official said there is evidence that European governments are growing increasingly concerned because their citizens are being injured as well and because of a sharp decline in tourism.