Nothing has quite so startled President Reagan as the sudden transformation of Sen. Barry Goldwater (R-Ariz.) into an enemy of the MX missile.

The 75-year-old senator, one of the Pentagon's staunchest advocates, told The Washington Post last week that he thinks the monster missile should be killed.

In the weeks since his electoral triumph, the president has received several warnings that the Senate, his lapdog for four years, is showing its teeth. The election of Sen. Robert J. Dole (R-Kan.) -- a dissenter on taxes, food stamps and voting rights -- as majority leader was a disappointment to the White House. The announcement by Sen. David F. Durenberger (R-Minn.) that he was taking a final position against the secret war in Nicaragua was another jolt. But Goldwater's heresy was the rudest shock.

Reagan gave a lame explanation for this singular turn of events at his news conference Friday. His old friend and loyal ally, he said, was expressing resentment not at the MX but at the "continued harassment and niggling at the program that's been taking place in Congress."

That is not what Goldwater said. His words were: "You don't go out and pick a fight you're going to lose."

The administration is taking what comfort it can from the fact that the senator is a celebrated pop-off and often takes things back.

It is that memory that constrains the joy of MX foes, who could hardly be more pleased than if Defense Secretary Caspar W. Weinberger had joined them.

"Will he stick with it?" both sides ask.

The most recent charge-and-retreat episode in Goldwater's long history concerns the CIA mining of Nicaraguan harbors. As chairman of the Senate Intelligence Committee, Goldwater sent a scorching letter to CIA Director William J. Casey, pronouncing himself "pissed off" by Casey's actions. But soon afterward he voted against a resolution condemning the mining and subsequently has found public occasion to speak kindly of Casey.

But according to Rep. Thomas J. Downey (D-N.Y.), one of the organizers of House resistance to the MX, "the damage has already been done -- waverers can get cover by saying that if MX is too much for even Barry Goldwater, it's too much for them. If he takes it back, he will look senile."

Goldwater wasn't shooting from the hip this time. Before he gave the interview, he called in the staff of the Senate Armed Services Committee, which he will chair next session, and informed them that he wants a freeze on military spending and the death of the MX.

Gen. Brent Scowcroft, the quiet magician who as head of the Scowcroft Commission brought the MX back from the grave two years ago, said he had no idea what got into Goldwater, whose enthusiasm for new weapons systems is legendary.

"I was surprised," he told a press breakfast.

Production of the MX, which Reagan nicknamed "Peacekeeper," has been held up pending release of funds until Congress is satisfied that progress is being made in arms talks. The missile will come up for another vote in March in a test of Reagan's second-term leadership. Scowcroft thinks its chances of survival in the House are marginally improved because Republicans picked up 14 seats, and somewhat worse in the Senate, where it twice suffered a tie vote that had to be broken by Vice President Bush.

"It's the weapon you love to hate," said Scowcroft, who doesn't think much of it himself. "It has become the focus of everyone who wants to go on record as protesting the arms race."

He still thinks of it as a bargaining chip, although the Soviets have laid waste to his theory. Its prospective deployment was supposed to scare them to the bargaining table. But while it was winning in Congress, the Soviets walked out.

While they were out, Rep. Les Aspin (D-Wis.), the leading Democratic advocate of MX -- although he too professes to hate it -- said that, despite its failure as a bargaining chip, we could not eliminate it because to do so would be "rewarding" the Soviets for taking a walk.

Now that the Soviets are prepared to return to the table while the MX is in limbo, Scowcroft says we must not bury it. "One of the worst things we could do right now is to unilaterally get rid of the MX. The bargaining chip is much more important than it was a year ago when nothing was going on."

In other words, Reagan wants the MX no matter what the Soviets think of it. But with Goldwater walking out on him, he might do better to put the thing up for private funding. The "contra" war in Nicaragua has been "privatized," and if he made MX contributions tax-deductible, he might be able to deploy the full 100 he has in mind. It might be easier than battling it through Congress again.