Secretary of State George P. Shultz said yesterday that the overthrow of Libyan leader Muammar Qaddafi by military coup would be "all to the good" and that the targets in Monday's U.S. raid were selected to make an impression on Libya's armed forces.

Shultz, meeting with reporters at the State Department, denied that Qaddafi was "a direct target" of the raid, but his remarks approving of a coup and describing the target-selection process left no doubt that toppling the mercurial Libyan leader was, and still is, a prime objective of official U.S. policy.

Shultz said he lacks sufficient information to say if there is "movement toward a coup" in Libya. A White House official said U.S. intelligence reports indicate that one military unit rebelled against Qaddafi Wednesday but that the Libyan air force put the rebellion down.

U.N. Ambassador Vernon Walters, speaking yesterday at the National Press Club, expressed the view that Monday night's U.S. attack should give Qaddafi's opponents "new hope."

Walters, who was a special envoy to European leaders just before the U.S. raid, said that gunfire heard near Qaddafi's headquarters in Tripoli Wednesday suggested a conflict within armed elements of his regime. "Soldiers were running out of the barracks," Walters said. "There was also gunfire from boats in the harbor toward the land. They were not pointed up in the air or out to the open sea."

At the White House, President Reagan told reporters in a brief meeting that he does not know the whereabouts of Qaddafi. "I just think he's been staying undercover while the shooting is going on," Reagan said.

Vice President Bush, speaking to a joint session of the New Hampshire legislature yesterday, called Qaddafi "an insipid monster" comparable to Rasputin, Hitler and Stalin. Bush added that "history always handles the monsters . . . . And here's a corny line but it's true: the good guys triumph in the end."

According to Shultz, the bombing targets in Monday's raid were selected to "send two messages" to Libyan forces: to destroy military equipment "that the Libyan military put some store by" and thus demonstrate that Qaddafi's policy is costly to them, and to hit Qaddafi's "Praetorian guard" of elite bodyguards to demonstrate that they are not invulnerable.

Shultz's report on the target planning added new elements to those announced at the White House Monday night. At that time, Reagan, in a televised address, said the targets were "the headquarters, terrorist facilities and military assets that support Muammar Qaddafi's subversive activities." Press spokesman Larry Speakes said the targets were "terrorist infrastructure" plus "limited defense suppression missions." Secretary of Defense Caspar W. Weinberger said the targets had "a full terrorist connection."

Explaining that the U.S. targeting was not directed at Qaddafi personally, Shultz said, "We have a general stance that opposes direct efforts of that kind." An executive order signed by President Ford in 1976 and reaffirmed by Presidents Carter and Reagan prohibits any U.S. attempt at assassination of foreign leaders.

Shultz said any successors to Qaddafi would have "a more pro-Libya orientation," suggesting they would give higher priority to the country's internal problems and lower priority to international conflict. Libya's resources for dealing with its problems have dropped with falling foreign exchange earnings, Shultz said.

The secretary of state, who has been campaigning for two years for the use of U.S. military force against international terrorism, told reporters that he feels no sense of satisfaction from this week's turn of events.

"I wish we weren't at this point . . . . I don't have any particularly good feeling about that," said Shultz, sitting in a wingback chair before a glowing fire on a wet afternoon.

He described Reagan's decision to use military force against Libya as "right" and "important," and said the basic decision had not been controversial within the circle of close presidential advisers. There had been "a lot of discussion" about the particular targets, Shultz said.

He said he was not surprised that the Soviet Union took some action following the raid, but told reporters he did not know precisely what Soviet leader Mikhail Gorbachev meant in telling Qaddafi in a letter that "we had repeatedly made serious warnings to the American administration about the dangerous consequences" of military moves against Libya.

The administration remains ready to "roll up our sleeves" and work on the practical problems of Soviet-American relations despite the Soviet action in canceling Shultz's pre-summit planning meetings with Foreign Minister Eduard Shevardnadze, which were to take place here next month.

Shultz took a relatively relaxed view of the turbulence within the Atlantic alliance over the U.S. bombing raid. Despite initial differences, he said, the allies have "very quickly coalesced in recognizing the problem . . . on a much stronger basis than a week or so ago." He maintained that yesterday's meeting of European foreign ministers in Paris and other developments in recent days add up to "a sense of motion" against international terrorism among the allies.

While expressing "regret" that U.S. warplanes were refused permission to fly over French territory en route to their Libyan targets, Shultz said approvingly that France is "increasingly and very much alert" to the problem of terrorism.

"The French are very special to deal with . . . a joy in some cases and not so much of a joy in other cases," said Shultz, adding, "this is one we didn't enjoy."

In a related development yesterday, Assistant Secretary of State Robert E. Lamb, who oversees embassy security around the world, said he is concerned about the safety of up to 70 U.S. diplomatic posts. Lamb told the Associated Press that since October Libya has been collecting intelligence about U.S. facilities abroad and has a terrorist infrastructure in place.

Lamb said "credible" bomb threats against U.S. diplomatic posts have doubled, to about a dozen per day, since Monday's attack.