Afghanistan's new revolutionary rulers recently celebrated their first rocky six months in power by discarding the traditional red, green and black flag for a red national emblem.

For many Afghans and foreigners in this once classic East-West buffer state, the well organized flag-changing ceremony was not just a tardy admission of the pro-Soviet government's political predilections. Rather, draped over storefronts, cars and mosques, the red flag was considered another provocation that could help bring the new leaders to grief in one of the most backward, intensively Islamic and anti-communist of countries.

The new government, nervous and shaky, already faces armed rebellion in some of the world's most rugged mountains, resistance to social reforms and a military and civil service elite resentful over repeated purges. Waving a red flag seemed inexplicable.

Equally baffling is why the Soviets, who in recent years have had strong influence here anyway, seem so willing now to rein in the schoolboy excesses of their avowedly adoring Afghan followers who seized power April 27.

Gone are the precoup days when the Soviets could hide behind the inefficiency and soverignty of the government of Mohammed Daoud. Now they are on full public display as Prime Minister Noor Mohammad Taraki and his comrades plan revolution in a feudal society as seemingly unfit for communism as Marx himself considered 19th century Russia.

With a countercoup in mind, the Soviets have vastly increased the number of their advisers. As many as half the 3,000 to 4,000 thought to be here are said to be assigned to the armed forces, with Soviets present down to battalion level.

The Soviet presence generally - and especially that of the military - is resented by everyday Afghans. There feelings are evident in the contempt shown anyone large and blond by shopkeepers and in the complaints that Russians are poor tippers.

Travelers around the country report seeing Soviet ammunition convoys and running into signs of resentment and disenchantment with the government's pro-Soviet tilt among nationalist-minded Afghans who originally welcomed the April coup. Barracks tensions, according to unconfirmed reports, have degenerated into fatal disputes between Soviet advisers and Afghan troops in bases close to Kabul.

"It's no bed of roses for Moscow," a senior diplomat remarked. "It's going to cost them money. They risk a counter coup or civil war at any moment and probably couldn't afford to pull out for fear the Kabul regime would collapse."

But the stakes are high for the Soviet Union, less for what Afghanistan is than for its geographical position.

For the first time since the czars eyed the warm water ports of the Indian Ocean more than a century ago - and since Britain sacrificed thousands of troops here to prevent Russia from threatening its Indian empire - the old dream is theoretically within Moscow's grasp.

Only hundreds of miles separate the Soviets from their goal and they have built a north-south all-weather road straight from the Soviet border to the Khyber Pass leading into Pakistan.

Now the real prize is the world's most important and vulnerable oil route - in and out of the Persian Gulf and around the Arabian Sea Troubles in Iran and Pakistan, which border the vital waterways, make a strong position in Afghanistan all the more important to the Soviets.

Some of the analysts wonder if the United States and the Soviet Union are involved in a regional trade-off - Moscow's continued good behaviour in Iran swapped for similar American forebearance here.

But in fact, there appears little the West can do here short of waiting and hoping that Afghanistan will evolve into a kind of Asian Yugoslavia despite its common border with the Soviet union. The United States, West Germany, Britain, France and other noncommunist nations are continuing aid to Afghanistan, but on a selective basis for at least another year.

Recently the Export-Import Bank approved a $50 million purchase of a DC10 by Irania, the Afghan airlines.

With undoubted blessings from the cash-short Soviets who have preemtped projects developing considerable Afghan oil, natural gas, copper, and uranium, the new government is pushing the West to increase its aid.

Such are the contradictions of a government whose soldiers carry Soviet weapons, but wear peaked czarist caps or World War II German helmets. Seen in this light, it is understandable that the government vehemently denies Marxist or communist aims and repeats invocations "in the name of God, the merciful and compassionate" to soothe anticommunist Moslems.

Asked whether the regime was communist, Foreign and Defense Minister Hafizullah Amin said in an interview: "We will never give you a clear-cut answer,"and "call us what you want."

In an otherwise calm interview, the government's number three man, Dr. Shah Wali, the planning and public health minister, exploded: "It is quite hateful for the Western media to treat us as if we have lost our identity.We have fought for more than 2,000 years to preserve it."

"If people have suspicions, that is not our fault," he said. "For centuries we languished under the most repressive regime in this part of the world and no one cared about us."

Saddled with a country one foreign expert described as "dead last in almost every statistic," the new Afghan leaders seem genuinely dedicated to development.

But, however laudable such efforts may be, they risk fitting into a seemingly unerring pattern for narrowing the government's political base.With the ruling People's Democratic Party of Afghanistan, Taraki's khalq (Masses) wing eliminated the more pro-Moscow Parcham (Flag) faction within weeks of the coup.

Hundreds of Parcham followers in the civil service have been removed and six Parcham leaders posted abroad as ambassador's in June have disobeyed orders to return to Kabul. Their exact whereabout are unknown.

But no one is counting them out, least of all the Soviets for whom they constitute a potential alternate governing team.

Armed uprisings in the rugged mountains east of Kabul along much of the porous border with Pakistan have been reported almost ever since the coup here. Mig 17 from the Afghan air base at Jelalabad reportedly have strafed and bombed dissident villages in retaliation for what apparently is limited to hit-and-run guerrilla attacks against Afghan Army units. An estimated 8,000 to 10,000 tribesmen and their families have sought refuge in Pakistan.

Unsubstantiated reports in a land famous for Byzantine intrigue and rumor mongering claim Soviet troops are fighting alongside the Afghans. They purportedly are Uzbeks and Tadzjiks - tribes that live in the Soviet Union and Afghanistan - to make their presence less obvious.

By wider agreement, more arms, military advisers and technicians started arriving from the Soviet Union in June.

Backing for the insurgents is equally unclear, although China, Pakistan, Libya and Iran are variously mentioned.

So far, analysts do not rate the insurgents as a major danger to the regime largely because of their historic inability to get together under effective leadership.

"Nothing to worry about," was Amino's description of the fighting, which he blamed on "outside enemies constantly plotting against our revolution."

He also denied any Soviet military involvement in the fighting, asking: "Do you know any Soviet expert in the world who after World War II has intervened in the internal affairs of any country?"

More worrying for the government are the potential repercussions inside the armed forces of the arrest last August of Defense Minister Abdul Khadir, the hero of the April coup; Lt. Gen. Shahpoor Ahmadzai, the army chief of staff; and two alleged civilian fellow plotters.

Some Afghans and foreign observers wonder how long the largely Soviet-trained officer corps will put up with the meddling. As many as 800 officers have been weeded out, according to some sources.

Amin, credited with infiltrating the armed forces before the April coup, was reported at loggerheads with Khadir largely because of arguments over the top military assignments.

Also heightening tensions have been Decrees six and seven, respectively scaling down farmers' debts to money-lenders and abolishing the bribe price system.

"The government is certainly not shying away from provocation," a diplomat said, noting that "the entire society is regulated by the bribe price," which provides a kind of social security system in tribal Afghanistan.

A longtime foreign resident said he had stopped counting after seven the number of murders near Kabul involving debtors who have invoked Decree six to avoid paying back their debts.

The government has been more pragmatic in carrying out its self-proclaimed number one priority - land reform - which now has been postponed for another year.

Signs of nervousness abound. A Soviet machine gun graces the ground floor of the Foreign Ministry and soldiers armed with AK47 assault rifles and bayonets patrol inside and outside public buildings.

Two dozen Soviet-built tanks are parked inside the old royal palace, now rebaptized "People's Home." Visitors are admitted only after a metal detector search and Amin apologized by saying, "My colleagues keep just this part of town under close observation."

At the northern approaches of the capital, a half-dozen thanks stand guard, soldiers check travelers for knives and weapons and an 11 p.m. curfew continues.

"This is not a rule-of-law country and this is not a regime that's going to submit to a secret ballot," a diplomat said. "Violence is endemic. The law is based on vengence and the government has always been a police state."

Departing for the first time from the long-maintained insistence that the revolution had arrested fewer than 100 persons, Amin said "about 4,000" Afghans had been arrested. An undisclosed number - including about 100 women and children related to the overthrown Daoud - have been released.

Since September, foreign residents are obliged to inform the Foreign Ministry 48 hours before traveling outside Kabul.

A British textbook advisory mission has been phased out and a longstanding University of Nebraska Afghan studies program seems about to follow suit.

Louis Dupree, an American with 30 years of experience here and author of a major study of contemporary Afghanistan, was forced to leave when his residence permit was not renewed.

Suddenly Soviet-trained Afghans, such as the 14-year veteran of Radio Moscow's Afghan service and now head of television have come forward.

Western and many nonaligned diplomats in general see only "official" Afghans for fear of causing their personal friends problems. A Westerner whose work takes him often to the countryside reported many old Afghan friends prefer to see him only briefly, if at all.

Merchants pay as much as 40,000 Afghanis - just over $1,000 - to obtain papers to travel abroad. In the countryside travelers report cases of bumptious young party officials lording it over increasingly angry fellows citizens.

For Amin, if the regime is really threatened, "We will definitely get Soviet help." He stressed, however, "We have not yet asked for it."

A foreign resident was less optimistic. "If the tribes really got started in Jelalabad they'd be here nightfall. This is not the end of the story."