The Soviet Union confirmed today that its troops are operating in Afghanistan in support of the new Kabul government, and President Leonid Brezhnev sent "warm congratulations" to Babrek Karmel, whose coup succeeded with the help of Soviet armor.

The quick, though factually thin, Soviet disclosures indicated a deep commitment by the Kremlin to securing the survival of a pro-Moscow regime in Kabul, even at the risk of losing the SALT II treaty with the United States.

The official Tass news agency asserted in a dispatch from Kabul that the Afghan government sought Soviet military and technical aid to defend itself against "interference and provocations of external enemies" under terms of a Dec. 5, 1978, Moscow-Kabul friendship treaty signed by Brezhnev and Nur Mohammed Taraki, the original leader of the Marxist government that came to power in April 1978.

"The government of the Soviet Union has met the request of the Afghan side," Tass reported.

The news agency quoted a telegram from Brezhnev to Karmel, wishing him "big successes" in the task of leading the country.

The Soviets had told governments around the world today that Soviet troops fought in Afghanistan at the request of authorities there "to resist external aggression and interference," Washington Post correspondent Stuart Auerbach reported from New Delhi.

The external threats were unnamed, but Soviet sources in New Delhi said they were the Pakistanis, who have given tacit support to rebel groups, and the Chinese.

But diplomatic observers in New Delhi, Auerbach reported, described Moscow's action as "the largest Soviet troop movement outside Eastern Europe since World War II" and said it is "almost a Soviet invasion of Afghanistan -- taking Kabul and then putting their man in power."

The Tass dispatch today did not answer any of the basic questions surrounding yesterday's coup, which toppled Hafizullah Amin and installed Karmel. The Soviets, who normally cloak their military activities in secrecy, have never acknowledged the sudden, massive airlift of an estimated 5,000 troops into Kabul in recent days or the reported positioning of three to five Soviet divisions on the Afghan border prior to the coup.

Throughout the day, the Soviets changed the wording of the Tass dispatch in an apparent attempt to give the impression that the military operations and the coup were not simultaneous.

But reliable and well-informed, though unofficial, Soviet sources said today there is no doubt that the military operation, which went off like clockwork, had been planned far in advance with the participation of Karmel, a staunchly pro-Moscow Afghan Communist who was purged earlier this year after a falling-out with Amin, the man he has now succeeded.

Last night and today Tass quoted from a statement issued by Karmel condemning Amin as a dictator, torturer, murderer, and "agent of U.S. imperialism."

On Moscow television commentator Anatoly Potapov read a clause from the 1978 friendship treaty, which provides for mutual measures to ensure security, independence and territorial integrity.

"It is clear that the developments in Afghanistan are an internal affair, strictly an internal affair, of that country," Potapov declared, in a clear indication that Moscow would oppose any discussion of the Kabul events at the United Nations.

Potapov gave no details of the military support being dispatched to Afghanistan, although Soviet citizens learned from Western radio broadcasts of the dispatch of Soviet forces. He said the situation in Kabul was now quiet.

The view that Moscow has long planned the current operation in Afghanistan is widely shared by veteran foreign diplomats. They were nervously wary, and are now alarmed by the strength of Moscow's determination to establish control in the land-locked but strategically important, impoverished nation to the south.

"They intend to hold this salient at all costs and the personalities are unimportant," one foreign observer asserted in a characteristic remark.

These observers view entry of Soviet military units into Afghanistan as certain to have a marked psychological effect on the Moslem insurgents opposed to Kabul, regardless of whether the Soviets intensify their combat operations.

Soviet sources suggested indirectly that it is highly unlikely now that Moscow will suddenly reduce its military presence with the establishment of Karmel in place of Amin in Kabul.

"Afghanistan presents a chance for action, for promotion, and for experience for a military establishment that has used surrogates generally in other similiar situations," one Soviet source said. He cited Angola and Ethiopia as examples of episodes in which the Soviets relied on Cuban troops to do the majority of the fighting in support of rulers backed by Moscow .

The Kremlin's Afghanistan calculations also appear to reflect Soviet worries over the state of relations with the revolutionary Islamic government of Ayatollah Ruhollah Khomeini in Iran. Though Moscow has assiduously sought to curry favor with Khomeini in the current American hostage crisis, Khomeini has shown little inclination to alter his pugnacious attitude toward the Soviets. Moscow's demonstration of force in neighboring Afghanistan is sure to have impact in Tehran.

Whatever side effects its intervention in Kabul may have, however, Moscow's motivation appears to stem from a set of worries and potential opportunities remarkably similar to those that sparked its 1968 invasion of Czechoslovakia. Then, the cautious, conservative Brezhnev leadership moved only after it had reached two basic conclusions: vital Soviet hegemony in Eastern Europe was threatened by the drift of Alexander Dubcek's government to democracy; and Soviet military action would not bring on a major East-West confrontation.

Amin's three months of leadership in Kabul began as an embarrassment to the Soviets. He ousted Taraki just five days after Brezhnev personally assured Taraki of continued Soviet support. Amin quarreled with Moscow, forcing the recall of the Soviet ambassador on the ground that he had been sympathetic to Taraki. His rule was distinguished for being even bloodier than his predecessor's, and it further inflamed the countryside despite increased military assistance by Soviet "advisers." Amin seemed unable to widen his power base and the Soviet move is, in the view of one seasoned observer today, "a loss-cutting operation."

As with the invasion of Czechoslovakia, the Soviets have issued an official explanation asserting that the Kabul troubles are both an "internal matter" beyond outside response, and an intervention based on the legitimate request of a legal government.

One Soviet source with long experience assessing Kremlin policy suggested the Politburo also was guided in reaching its decision by its unhappy Egyptian reversal. There, President Anwar Sadat cost the Soviets billions of rubles of military and technical aid when he turned toward Washington after the 1973 Arab-Israeli war.The Soviets have never regained their foothold on the Middle East.

"Amin was the kind of unpredictable leader they have learned to despise -- and try to replace," one source commented.

Foreign observers here reject comparisons between the present Soviet position in Afghanistan and the American involvement in Vietnam. They argue that unlike the North Vietnamese and Viet Cong, the Moslem and tribal guerrillas in Afghanistan have no staunch outside supporters who can supply arms and money, no unified leadership and little command organization.