Soviet physicist and dissident Andrei Sakharov says the West should bolster its military strength--even if that means building the new MX missile and prolonging the arms race--to balance Soviet power and avoid the "main danger" of "slipping into an all-out nuclear war."

Sakharov, 62, a Nobel prize-winning scientist, who has been exiled within his own country for criticizing Soviet human rights policies, laid out his views on the nuclear arms debate in an article in the current issue of Foreign Affairs magazine.

The article is written as an open letter to an American colleague, physicist Sidney Drell of Stanford University.

It was smuggled out of Gorky, the off-limits city 250 miles east of Moscow to which Sakharov has been banished, and translated with the help of his son-in-law, Efrem Yankelevich, who lives in Newton, Mass.

Sakharov, once a leading Soviet weapons scientist, has managed to get other writings out of the Soviet Union. But this is his first major assessment of the nuclear arms issue.

Yankelevich, interviewed by telephone, said there is "no doubt" these are Sakharov's views but that he "cannot elaborate" on the manner in which the article reached the West.

Sakharov dwells on the theme of nuclear war as "a calamity of indescribable proportions" that would amount to "collective suicide" no matter which side starts it.

He argues forcefully for atomic arms control and is critical of a U.S. strategy that threatens the first use of atomic weapons in Europe to stop a Soviet conventional attack there.

But most of what he says will probably dismay those in this country who advocate a weapons freeze and are against the MX and new Pershing II and cruise missiles in Europe.

At the same time his words will probably be read with some satisfaction within the Reagan administration.

Sakharov essentially argues that to deter war it is necessary to retain parity in arms so that neither side feels it can safely take the first aggressive step.

"If the probability of such an outcome . . . slipping into an all-out nuclear war . . . could be reduced at the cost of another 10 or 15 years of the arms race, then perhaps that price must be paid," he says.

"It would be wiser to agree now to reduce nuclear and conventional weapons and to eliminate nuclear weapons entirely. But is that now possible in a world poisoned with fear and mistrust?" he asks.

Sakharov criticizes the West for not matching Soviet ground forces in Europe, a weakness that he says could lead the West to a too-easy crossing of the nuclear threshold.

Similarly, he argues that deterrence of nuclear war requires a finely tuned strategy that takes account of different kinds of warfare and different regions of the world, rather than one that rests only on the ability of the two superpowers to destroy each other.

Thus, he supports the western plan to combine a quest for arms control with a plan to deploy new Pershing II and cruise missiles in Europe to balance already-fielded Soviet missiles if no accord is reached.

"For these talks to be successful the West should have something that it can give up. The case of the Euromissiles once again demonstrates how difficult it is to negotiate from a position of weakness.

"Only very recently has the U.S.S.R. apparently ceased to insist on its unsubstantiated thesis that a rough nuclear parity now exists," he says.

Sakharov chides those in the West who criticize the western plan without making any demands on Moscow.

He says that in the West "Pro-Soviet propaganda has been conducted for quite a long time and is very goal-oriented and clever, and that pro-Soviet elements have penetrated many key positions, particularly in the mass media."

Sakharov makes a similar case that "a great advantage" Moscow holds in powerful ocean-spanning land-based missiles also must be confronted. "Perhaps talks about the limitation and reduction of these most destructive missiles could become easier if the United States were to have MX missiles, albeit only potentially.

"While the U.S.S.R. is the leader in this field, there is very little chance of relinquishing that lead. If it is necessary to spend a few billion dollars on MX missiles to alter this situation, then perhaps this is what the West should do."