President Reagan exchanged emotional farewells yesterday with Defense Secretary Caspar W. Weinberger in a ceremony that also marked a transition from the rearmament years of Weinberger's tenure to a new phase of arms-control agreements in the final stretch of Reagan's presidency.

Weinberger, often a hard-liner on arms accords, made no mention of any prospective Soviet-American arms treaties during a White House Rose Garden ceremony at which Reagan also announced his nomination of national security adviser Frank C. Carlucci to succeed Weinberger. Reagan also named Carlucci's deputy, Army Lt. Gen. Colin L. Powell, to be his sixth national security adviser.

In his farewell remarks, Weinberger spoke forcefully of Reagan's devotion to the Strategic Defense Initiative, the research effort opposed by the Soviets to build a space-based missile defense system. Until Reagan embraced the SDI concept in 1983, Weinberger had expressed doubts about it.

"You've steadfastly kept us to the goal of deployment of your Strategic Defense Initiative, toward which we are making very great progress very rapidly," Weinberger said. "And you've refused all temptations, Soviet or otherwise, to be diverted from that deployment."

Only last week, in announcing his Dec. 7 meeting here with Soviet leader Mikhail Gorbachev, the first summit with a Soviet leader in the United States since 1973, Reagan said he would discuss flexibility in the deployment schedule for the missile defense system as part of the negotiations on strategic arms.

The administration is now turning attention to a possible agreement to halve strategic arsenals and some high-ranking officials said they expect Carlucci to be more of a "problem-solver" in arms control. By contrast, Weinberger, in his departure remarks yesterday, preached the virtues of adherence to principle which he said "must come ahead of what's popular."

At a later Pentagon news conference, Weinberger said he hoped the arms-control agreements would not come "at the cost of injuring, in any way, strategic defense or our ability to deploy it as soon as possible."

"If we want to deploy, then we shouldn't cripple ourselves and tell ourselves we can't think about certain things, or make up lists that we mustn't mention," he told reporters. "I don't think we should offer it up or yield any blandishments or any glittering prizes that the Soviets may dangle in front of us."

Weinberger's departure is viewed by some high-ranking officials as the end of an era in which he was an unyielding advocate for defense programs and who often counseled Reagan toward confrontation. "Frank Carlucci is not Cap Weinberger," said a senior White House official who has worked with both. "They have two different styles, two different approaches, and they will serve in two different time frames."

This senior official predicted that Carlucci would be able to "resolve many of the problems that now exist in the conflict between the administration and Congress on defense policy" and "he may or may not be able to facilitate negotiations with the Soviets on important issues." Carlucci, the official added, is "as tough" on SDI and treaty verification "as Cap ever was."

Sources said Weinberger notified Reagan more than two weeks ago of his intention to resign because of the deteriorating health of his wife, Jane. Weinberger said yesterday that his wife is "extremely uncomfortable" becuse of two or three broken vertebrae. He said she had been treated for cancer but had consulted "a great many doctors" who think the malignancy is gone.

Weinberger said he offered his resignation because "I think it's time I do a bit more to fulfill those obligations" to his wife. "And that's the long and the short and the tall of it."

The sources described Weinberger as reluctantly acceding to Jane Weinberger's insistence that he step down. "He really hated to do it," said an official familiar with the decision. After a private meeting with the president to inform him of the decision, "it was like the wind had gone out of his sails," this source said.

A Pentagon officical said that when Weinberger informed Reagan of his plans, "no attempt was made to talk him out of it." The official said that "this caused him considerable disappointment."

The sources also said Weinberger asked Reagan to nominate Deputy Secretary William H. Taft IV as his successor. However, other administration officials, including White House chief of staff Howard H. Baker Jr., pushed Carlucci, who sought the post. Weinberger went out of his way yesterday to praise Taft, saying he would remain the second-ranking official at the Pentagon.

Weinberger, according to the sources, did not leave in disagreement with Reagan's plans to sign the intermediate-range nuclear forces (INF) treaty at the summit Dec. 7. The sources noted that the "double-zero" option largely originated in the Pentagon in 1981 and that Weinberger had succeeded in winning several internal battles on the treaty, which would eliminate medium-range and shorter-range missiles in Europe.

"He is resigned to the INF treaty," said an official who has worked closely with Weinberger. "The real fight now is START," the strategic arms reduction talks, the official noted. Had Weinberger remained, he would have had "great incentives to see the battles through" on strategic arms, the official said, and his departure may reduce internal friction over an agreement.

"Tenacity is his strongest suit, and a lot of people think things will be better because that tenacity is gone," this official said.

Speaking of the prospective INF treaty, Weinberger told reporters, "I think we should focus on getting that ratified, and not be concerned with a great many other things that may or may not flow from the INF agreement." Reagan and other senior officials have said the INF treaty is an important first step toward a strategic arms agreement.

Staff writers Molly Moore and R. Jeffrey Smith contributed to this report.