Before leaving Nanning in southeast China, a few of us American journalists wanted to check out the tapesteries at the local "friendship store," one of hundreds of foreigners-only shops now found throughout China. I bought a Coca-Cola and inspected ome of the store displays, then heard commotion near the front door.

An old man wearing shabby blue cloths and a long beard stood outside and shouted, "Why can't I go in there? All those foreigners can go in." A store clerk smiled nervously and tried to quiet the man. "Isn't my money good enough? Damm it, this is not fair." He took a few coins out of his pocket and threw them at the clerk's feet. We picked up our parcels and walked past him to our waiting bus. I felt uncomfortable and a bit ashamed.

In the past few years China has turned its friendly face to foreigners. Americans in particular are being allowed to live or visit here in increasing numbers. Chinese receive us every where with enormous courtesy and that seems to me genuine warmth. Yet I cannot forget that old man at the Nanning friendship store. Particularly when good will between Chinese and Americans seems so important as we tiptoe through the mine field of the 1980s.

Despite its modern, socialist trappings, China remains an ancient, insular country whose citizens still do not know what to think about people who are not Chinese.

Unfortunately, foreign life styles here in some ways recall the last century, which ended in 1900 with the Boxer Rebellion. In that year people probably little different than I mounted walls in Peking near where I now live and fired at mobs of rabidly antiforeign Chinese.

FOREIGNERS TODAY enjoy not only friendship stores, but better hotels, special rooms in restaurants, airports and railway stations and an overwhelming tendency by Chinese clerks to push them to the head of any line.

I have seen Chinese physically pushed aside to make way for waiting foreigners. When I get on a bus, the conductor often will order Chinese passengers to give me a seat. Discontent at this has gotten to the point where even the controlled press prints protest letters. One Chinese traveler wrote that foreigners seemed to be treated like "fairy emperors" and wondered whether the Chinese had any "national self-respect."

A thoughtful Chinese -- American journalist, Frank Ching of The Wall Street Journal, has written of the times he has had to prove himself to be a foreigner before being treated with courtesy by Chinese officials who saw his Chinese face.

"There is a new danger of a colonial mentality emerging," Ching wrote. He said different treatment of Chinese and foreigners not only increased resentment of foreigners but led Chinese to feel inferior.

"A lot of people are sick of it," a Chinese friend told me, saying the treatment reminds them of the proverbial sign at the Shanghai park in the bad old days of the last century: "No dogs or Chinese allowed." Government officials argue that Chinese would soon empty the shelves if allowed into foreigners-only shops, leaving tourists nothing to buy. But a foreign diplomat insisted, "That's silly at the prices they charge.It would be a lot more crowded. The Chinese love window-shopping, but they couldn't afford to buy much."

LIKE OTHER CLOSED societies, China has gotten into the habit of isolating foreigners. Its leaders do not want to expose their own people to ideas and living standards that would disrupt their system. The latest Peking leadership, however, convinced of the need for a modern economy, already has opened doors to scientific exchanges. Voice of America broadcasts and foreign films.

This makes even more painful and illogical the "foreigners only" signs put up in front of upper-floor rooms in book stores and arts shops. I suspect that some of China's administrators have begun to get a taste for foreign-style privileges and do not want to spread them around. Army officers and high officials with special passes have begun to show up regularly at the jewelry counter at Peking's biggest friendship store. On Quanmen avenue, a loudspeaker regularly blares: "Make way for the automobiles of foreigners and high officials."

Given the right political soil, all sorts of ugly, xenophobic flowers can burst forth here. One need not go back to the Boxer Rebellion to get a whiff of them. The Foreign Ministry official who now graciously and energetically handles my requests for information participated a decade ago in the violent attack on Reuther correspondent Anthony Grey at his home during the Cultural Revolution. A humane and sophisticated man, the official apparently was forced to do it, but the incident illustrates the power that antiforeign ideas can muster.

AUTHORITIES NOW understand enough about popular resentment of the "democracy movement" in Peking.

Journalists and diplomats leapt at the chance to meet and talk with articulate young Chinese interested in democracy during last year's great ideological thaw. Nevertheless, they inadvertently planted the seeds for future foreign-bating by Chinese leaders who need such a popular issue as the resentment toward foreign privilege.