Defense Secretary Caspar W. Weinberger yesterday vigorously defended President Reagan's proposal for a strategic defense against nuclear weapons, dubbed "Star Wars" by its critics, but said Reagan had not excluded bargaining it away in arms talks with the Soviets.

Weinberger assailed critics of the president's proposal who insist that U.S. nuclear policy should continue to depend on deterrence, the theory that the Soviets can best be dissuaded from starting a nuclear war by the prospect of massive retaliation.

Weinberger said such a policy "condemns us to a future in which our safety is based only on the threat of avenging aggression."

Reagan has said that a space-based defense system might be an alternative to the continuing arms race on Earth. The Pentagon, for its part, wants to continue its research into space weaponry.

"Our safety and that of our allies should be based on something more than the prospect of mutual terror," Weinberger said in a speech to the foreign press center.

In the question-and-answer session that followed, Weinberger was asked whether his comments meant that the Strategic Defense Initiative (SDI) would not be included in forthcoming arms talks with the Soviets, where some officials have suggested it could be used as a "bargaining chip" to win agreement on other issues.

"I don't exclude anything . . . . The president has specifically not excluded anything," Weinberger replied. "I tried to explain the importance that he and all of us attach to the defense initiative."

White House officials who were aware of Weinberger's response emphasized that Reagan was "quite committed" to the SDI and wanted to explore it with the Soviets.

"We don't see any reason why we should be stampeded by the Soviets into backing away from anything that could save the lives of millions of people," one official said.

In an Election Day interview with The Washington Post, Reagan expressed a firm commitment to the SDI, while at the same time emphasizing his desire to reach an agreement with the Soviets that would reduce the levels of strategic nuclear weapons. Both the Soviets and domestic critics of the SDI have suggested that these twin goals may be incompatible.

The president said of the SDI in the interview, "I think this could be the greatest inducement to arms reduction."

Reagan -- and Weinberger in his speech yesterday -- acknowledged that the United States is a long way from proving that a strategic defense against nuclear weapons is feasible. But Weinberger contended that this was not a valid reason for scrapping the SDI.

"Another mistake critics of strategic defense make is to contend that effective defense is technically unobtainable," Weinberger said. "History is filled with flat predictions about the impossibility of technical achievements that we have long since taken for granted." He went on to quote Albert Einstein in 1932 saying there "is not the slightest indication" that nuclear energy will ever be obtainable.

Weinberger referred throughout his speech to the "U.S. and its allies," apparently in an effort assuage European fears that a strategic defense system would protect only the United States.

"This is quite wrong," he said. "The security of the United States is inseparable from the security of Western Europe."

British Prime Minister Margaret Thatcher, a firm supporter of Reagan on most arms control dealings with the Soviets, is to meet with the president Saturday at Camp David. There has been speculation that she might express British reservations about the SDI in her private meeting with Reagan.

The Reagan administration is preparing its strategy for talks that Secretary of State George P. Shultz is to hold in Geneva on Jan. 7-8 with Soviet Foreign Minister Andrei A. Gromyko. It is expected that these talks could lead to wide-ranging discussions on arms control issues between the two superpowers.

White House spokesman Larry Speakes said yesterday that Reagan has "every intention to be flexible" in these talks but cautioned that "we don't expect to be able to solve all the hard, complicated problems that are involved in U.S.-Soviet relations."

Reagan met yesterday to discuss these talks with Edward L. Rowny, chief U.S. negotiator for the Strategic Arms Reduction talks suspended early this year in Geneva. Rowny has been a member of a team developing U.S. strategy for the geneva talks.

Staff writer Walter Pincus contributed to this report