President Carter said yesterday that he will not back off his demand that the United States boycott this summer's Olympics in Moscow if Soviet troops are not removed from Afghanistan today. o

In a speech to the annual conference of the American Legion, the president blended his recent hard-line rhetoric toward the Soviet Union with a reaffirmation of his support for the strategic arms limitation treaty (SALT II) with the Soviets and a broad, political defense of his foreign amd military policies.

He also used the ocassion to jab at unidentified political opponents, including Sen. Edward M. Kennedy (D-Mass.), and others who have opposed the steps he has ordered in response to the Soviet invasion of Afghanistan.

"Within our own country," he said, "opposing voices have been raised against these necessary actions -- against the grain embargo, against the Olympic boycott, against registration for the draft, against full funding of the defense budget, which I have proposed to the Congress.

"In this developing debate concerning our national security, I need the support of freedom-loving Americans everywhere, and I am sure that I can count on my fellow Legionnaires for your support."

There has been some confusion in the last several weeks over whether the administration was softening its demand that the Soviet Union completely withdraw its troops from Afghanistan by Feb. 20 or risk an American boycott of the Olympic Games. Apparently hoping to end such speculation, Carter yesterday reminded his audience of several hundred American Legion members that that deadline is tomorrow," and added that "it will not be changed."

U.S. intelligence sources said yesterday the Soviets have given no sign of even a token withdrawal of forces from Afghanistan since the administration announced the deadline.

The president's reiteration of the Olympic boycott deadline drew strong applause from his audience, which listened to much of the speech in silence.

The president only briefly mentioned the American hostages in Iran. He said the negotiations for their release "have now reached a particularly sensitive and intense stage," adding that in those negotiations "my task is to protect the interests and the principles of our nation. . . ."

The speech contained many of the charges and much of the rhetoric Carter has used to desbribe the Soviet invasion of Afghanistan, including an assertion that the United States is "capable today of responding to a threat to peace in almost any part of the world." The president, in delivering the speech, added the qualifying word "almost" to his prepared text. d

But for the first time since the Dec. 27 Soviet invasion of Afghanistan, the president also spoke at length about his support for SALT II, which became one of the first casualties of the invasion when Carter asked the Senate to suspend consideration of the accord.

Arguing that passing of SALT II would reduce spending for nuclear arms and free funds that are needed to improve the American conventional forces," Carter said, "I will consult very closely with the Congress when the time comes again to move toward ratification of the treaty."

Moreover, in what may have been a preview of the kind of defense he will offer, once the Iranian crisis is over, for his recent foreign and military policy steps, the president said even the most punitive measures he has ordered against the Soviet Union have been designed to preserve peace.

"It is important that everyone understands that every action that I have taken is peaceful and is designed to preserve peace," he said. "Because we seek peace, we have pursued -- and will pursue -- every opportunity to ease tensions. Because we seek peace, we have been cautious and restrained."

Carter said Soviet leaders "miscalculated" in ordering the Afghanistan invasion, and that because their future plans cannot be known, "No president of the United States can afford to gamble our peace and security upon wishful thinking about the present or the future intentions of the Soviet Union.

"Our firmness is not a prelude to combat, nor is it a return to the Cold War," he said. "It is simply prudence -- to reduce the chances for a misjudgment that could be fatal to peace. It is reaffirmation of a longstanding commitment and a sustained response to a strategic challenge."

Defending the increase in defense spending he has proposed, and anticipating the debate over how this will affect the economy, the president said the higher spending "is a carefully measured amount, and it in no way signals a new or transient 'boom' in defense spending."

"The impact of the additional expenditures on the inflation rate will be negligible," he said. "These expenditures for defense are clearly within the capability of our American economy."