President Carter's national security adviser peered resolutely with gun in hand at Soviet controlled Afghanistan from the top of a Pakistani military outpost high above the strategic Khyber Pass.

It looked like a scene from a late-night Grade B television movie called "Zbig at the Khyber Pass" as Zbigneiw Brzezinski, high White House aide, hesitated for a second and then declined an offer to fire the Chinese-made light machine gun toward Afghanistan. Instead he invited the Pakistani soldier at the gunpoint to shoot the weapon.

The soldier got off one shot and the gun jammed.

After clearing it, he squeezed off a fast round. But the recoil knocked the soldier back into Brzezinski and the gun started spraying bullets wildly out the gunport.

"Thank God the Russians haven't started firing back," said a Pakistani officer accompanying the Brezezinski tour.

The madcap scene at the old British-built stone picket post -- really a tiny fort perched on top of a hillock two miles from the Afghan border -- climaxed a day's tour of Pakistan's frontier.

Brzezinski had asked to be taken from the Khyber Rifles officers mess in Landi Kotal to one of a string of pickets posts overlooking the Khyber Pass, the route of invading armies since 1600 B.C. when the Aryans moved down from Central Asis into what is now India.

"This would be smashed right away?" he asked Lt. Gen. Fazle Haq, the military commander and civil governor of the Northwest Frontier Province.

"In the first engagement the artillery would knock down all these," said Fazle, pointing to the post he was standing at and others down the pass. "They are all right for observation and for keeping track of tribals, but not for modern warfare."

Brzezinski clearly enjoyed the chance to see at first and the frontier he had been talking about from Washington since the Soviet Union moved more than 80,000 troops into Afghanistan late last year.

As he strode up the rocky hillside to the picket post, he opened his U.S. Army parka to show a highly ornamental dagger stuck in his waistband. The dagger, the type used by tribesmen in this area, had been presented to him at lunch by Fazle.

Earlier, he walked down a line of tribal chiefs who each placed a garland of flowers around his neck. Before long Brezezinski, up to his ears in flowers, quipped, "Friendship is a heavy burden, especially around the neck."

The tour started with an early morning helicopter visit to a remote refugee camp in the Kurram Agency, a finger of Pakistan that juts into Afghanistan halfway between Jalalabad and Gardez. The camp, known as Sadda, was 12 miles from the Afghan border.

The poorly clad refugees -- mostly old men, women and children with no men of fighting age, visible -- told Brzezinski through a translator that they had been driven from Afghanistan within the past six months because the Soviet-dominated government has attacked their mullahs, destroyed their mosques and villages and attempted to change their fundamentalist Islamic religious traditions.

They now live in tents with 40 cents a day to feed themselves.

There were no weapons present in the camp, really a straggly collection of tents in a barren spot in the rugged terrain, except those of the security guards. Officials said the weapons that tribesmen always carry had been taken away of the Brzezinski visit.

One tribal leader acknowledged that young men come and go across the open border to fight in Afghanistan.

Brzenzinski was careful not to promise military assistance to the rebels, but he told them of America's support for the efforts and said, "The entire world is outraged," by the Soviet invasion of Afghanistan.

Deputy Secretary of State Warren Christopher added, "the American people admire your fight for freedom and believe in the long run you will presevere."

As if rehearsed, the refugees replied in chorus, "Inshallah," God willing.