The Soviet Union is clearly worried about getting bogged down in a Vietnam-style quagmire in this rugged country where insurgents are killing dozens of their advisers.

At the same time, the Soviets are reacting in almost the same way as the United States when it first got involved in Vietnam in the early 1960s.

Top Soviet generals flew here last month to assess the situation, and soon after, Moscow poured in more arms to a government that has alienated vast numbers of its citizens and whose army is increasingly unwilling to fight.

Diplomats here take it for granted that only Soviet economic, military, political and diplomatic support keeps the year-old Afghan government in power against the assault of Islamic-oriented insurgents.

"By the same token," a diplomat said, "the Soviets' option to pull out entirely is no longer available. They are stuck."

Even Soviet diplomats here now make the comparison with Vietnam. The stakes are even higher for the Soviets in Afghanistan, moreover, than they were for the Americans in Indon-china.

Afghanistan borders on the Soviet Union, and if Moscow were forced to withdraw in disgrace, it would set an all-too-obvious example for their own Moslem republics-already aware of resurgent Islam in Iran-of pulling back in the face of insurgency.

The Soviets have anchored their presence here with massive amounts of military hardware, 1,200 to 2,000 military advisers and financial backing - all of which are considered more than adequate against a divided, ill-coordinated opposition suffering from a dearth of outside help in arms and money.

Some diplomats are convinced the Soviets will win if they can hang on for just another year. "Nothing will dislodge them then," one diplomat insisted.

Other analysts are not so sure.

"With an army unwilling to stand and fight and given to mutiny," a diplomat said, "the Afghans can hold Kabul and most big towns, but in the countryside the fighting could go on for three or four years."

Only opposition leaders based in Pakistan were foolish enough to predict the government's downfall during the recent celebrations marking the first anniversary of the revolution that brought Nur Mohammed Taraki, Hafizullah Amin and their Kahlqi (masses) branch of the divided Communist Party to power April 27 1978.

What is astounding is how the Afghans and the Soviets have so completely alienated a population which just a year ago was as willing as many Western powers were to give them the benefit of the doubt.

That openmindedness was prompted by hopes the revolutionaries would retain some semblance of traditional Afghan nationalism and carry out long overdue reforms in one of the world's poorest countries.

Within months, however, the new government began rubbing its citizens the wrong way by insisting on foisting a red flag on a deeply Islamic nation, ramming home reforms and arresting thousands. "They have succeeded in only one thing-alienating every layer of society," one diplomat said.

Today the Taraki government is faced with sporadic resistance in almost every province of this mountainous and remote country, in addition to a permanent insurgency in the east, where the writ of the central government has always been contested.

"The Soviets must wake up at night and wish for the good old days when they manipulated the government of Gen. Mohamed Daud [ousted by Taraki in a bloody coup] without having to take responsibility for its do-nothing ways," a Westerner remarked.

Now, successive purges have eliminated followers of Daud, the rival Parcham (Banner) communists, nationalists in and out of the armed forces, the crust-thin civil service and Moslem religious leaders. In addition, according to reliable accounts here, tens of thousands of ordinary Afghans have been imprisoned.

Surprisingly for a nation with a large Moslem population, the Soviets here proved as insensitive as Americans and other Westerners were in neighboring Iran to the resurgence of Islem.

It is only recently that 62-year-old party chairman Taraki and his right-hand man, Amin, began practicing Islam in public, posing for photographs in mosques and admitting the excesses of their overeager party workers.

"We know we have made mistakes," a Soviet official said privately, "but the revolution is here to stay-with or without Taraki or Amin."

Gen. Aleksei Yepishev, chief political commisar of the Soviet armed forces and a key figure in the invasion of Czechoslovakia in 1968, spent more than a week here in early April with six other generals to bolster Taraki, according to diplomats.

He arrived midway between two events which shocked both the government and its Soviet protectors-the Iranian-style uprising in mid-March-involving mass desertions by army troops and police in the western city of Herat, and an army mutiny April 20 in the key frontline garrison of Jalalabad, near the Pakistan border.

In Herat, for the first time, Soviet advisers as well as Khalqi Party workers were singled out for assassinations as Islamic insurgents and average citizens broke into armories and made off with weapons.

Since Yepishev's visit, the Soviets have provided more trucks, artillery, about 100 T62 tanks, small arms, improved MIG23S, SU20 bombers, MI24 rocket-armd helicopter gunships and more MI16 troop transports.

"It's not on the scale of the Ethiopian airlift" two years ago, one diplomat said, "but it's enough to scare the Pakistanis into believing the Soviets might be preparing a limited border war."

The Afghan army has been badly stretched and strained. Moved around from one brush fire to another, its officer corps repeatedly purged, its dollar-a-month draftees ill-trained and unwilling to shoot fellow Moslems, it has already shown serious signs of following neighboring Iran's armed forces into oblivion. Desertions have become commonplace. The April 20 mutiny at Jalalabad, involving four battalions, began when a captain refused to lead his men back to the rebel-controlled Kunar Valley. Accused of insubordination, the captain riddled the garrison commander with sub machine gun fire before leading the mutiny.

The Soviets lost two advisers in that mutiny, prompting the Soviet ambassador here to volunteer to colleague, "We have made sacrifices at a level that is unacceptable."

Successive purges, the latest of which involved more than 30 Air Force pilots and other officers, have made the Afghan armed services more dependent on the Soviets. Soviet pilots routinely fly jets and helicopters from the Jalalabad airstrip and were in action in the major air strike reprisals mounted against rebel-held Herat in March.

Taraki is well enough aware of the armed forces' questionable loyalty to have recently formed special defense committees composed of young Khalqi Party workers who have been give rudimentary military training.

Some analysts believe the Taraki government will win a respite until the fall harvest is in since the insurgents will otherwise face starvation this winter.

So far, Taraki has been lucky. The badly split opposition groups operate independent of each other throughout this Texas-sized country and so far have been unable to coordinate their attacks.

Outside help has been minimal despite the Afghans' unsubstantial accusations that Pakistan, Iran, China, the West and the Arabs are providing arms and money.

"If Henry Kissinger was still around there would be one hell of a temptation to get involved," one specialist remarked, recalling the former secretary of state's backing of the Kurdish uprising in Iraq in the early 1970s.

Intelligence analysts estimated the Afghan opposition needs a minimum guaranteed supply of 100,000 bullets a day to remain credible.

In Pakistan, bullets sell for a dollar a cartridge for the home-made variety and twice as much for imported ammunition. Insurgents in Kunar Province, north and east of Kabul and the main center of sunstained fighting have sold their cattle and women's jewelry to buy bullets and have slaughtered goats to keep alive.

"The insurgents are so hard up for modern weaponry that they are fighting armor the same way they fought the British cavalry in the 19th century-by provoking rock slides," a diplomat said. CAPTION: Picture 1, Moslem clergy and Afghan refugees march on Afghanistan's embassy in Tehran last March to protest the way Kabul government fought insurgents. UPI; Picture 2, Rebelling Moslem tribesmen show Soviet-made rifles they say were captured from the Afghan Army. Afghanistan Islamic Society