Two years ago the bars, clubs, discos and fast-food joints that had sprung up in this central Iranian city to accommodate a huge influx of Americans were doing a booming business, Now they are mostly business. Now they are mostly closed -- because of a lack of customers, crackdowns by authorities, strikes of firebombing by angry Iranians.

The Americans who once were conspicuous on the streets of Isfahan are making themselves scarce these days. They are hunkered down, keeping a low profile in a society that has largely truned against them.

This was especially true Sunday and today, when thousands of demonstrators filed through the city to show their opposition to the government of Shah Mohammad Reza Pahlavi. The marches were called by Iran's religious and political opposition to coincide with similar demonstrations elsewhere in the country.

The few Westerners who ventured outdoors received sullen stares and shouts of "Yonky go home" -- whether they were Americans or not. By no means all or even a majority of the more than 1 million Isfahanis hate Americans, but the segment that does is big enough to make being a Westerner here an uncomfortable experience.

The hostility stems in large part from heretofore unremitting U.S. support for the shah, which in the current explosive climate has stirred up many Iranians' traditional xenophobia. Aside from that, though, the Americans of Isfahan have in many ways done a lot to bring this ill will upon themselves.

Public drunkenness, barroom brawls, loud parties, gambling, drug abuse, prostitution: These have been some of the past complaints of local Iranians about American behavior here.

"It's like Sodom and Gomorrah down there," a U.S. official in Tehran said last year.

At the time, Gen. Hassan Toufanian, the Iranian vice minister of war in charge of arms purchases, also was deeply concerned. He warned American company officials that he did not want to see "Yankee go home" signs appear on the walls of Iranian cities.

Today his fear has come true.

Much of the problem comes from employes of the biggest U.S. firm here, Bell Helicopter International, which has a contract to train Iranian servicemen to run the shah's helicopter fleet, one of the biggest in the world.

The program has increased so much that Bell has had to hire just about anyone it can find with experience in flying and maintaining combat helicopters. Usually that has meant chopper pilots and mechanics who served in Vietnam.

Most of Bell's 1,800 employes still left in Isfahan are family men who do their work fairly conscientiously and stay out of trouble. But the behavior of others has stood out enough to tar everyone with the same brush.

"They're not exactly the cream of American society," one Tehran diplomat said.

"There are large numbers of two groups," said a Western resident of Isfahan. "A lot of Vietnam veterans whose only experience outside the country has been as basically an occupation force answerable to no one, and others are people who haven't been overseas before and just came for the money. Neither group can be expected to show a great deal of cultural sensitivity."

In the years since Bell arrived in 1973, a lot of the problems have come at times like this, during Iranian religious holidays of deep mourning for martyrs of the Shiite Moslem faith.

Although these are sad occasions for Iranians, for many American employes of Bell any holiday at all has been party time. Loud drunken parties with stereos blaring have done little to endear the largely conservative and often devoutly religious local population to American values.

Neither have the bars and clubs taken over by what one American here calls "survivors of the Southeast Asia floating crap game." Several such hangouts feature Vietnames bar girls -- some of whom entered the country illegally via Pakistan, others the wives or girlfriends whom Bell employes had met while serving in Vietnam and who had gone back to their old trade.

The exclusive nature of these places and the attitudes of some Americans meant that any Iranians who cared to enter were not welcome.

In their heyday, up to 40 Vietnamese women were invloved in prostitution here, according to American residents. When local police finally cracked down, they confiscated a variety of gambling equipment in addition to deporting some of the girls.

"It looked like the whole thing had been transplanted from Saigon," an American said.

"The prostitution probably antagonized the Iranians," he said. "They were certainly aware of the drinking and loud music. This did offend Iranian neighbors."

About the only American-style bar that still operates is the Long Branch Saloon. But even that has had to take its name off the door and restrict its business hours because of the martial law curfew. It closed for the current Ashura mourning days.

Another sore point with the Iranians has been the habit of some American women of going shopping in the bazaar, where religious fervor traditionally runs high, or even visiting mosques, while wearing clothes that would not draw unusual attention in Texas or California, but are not considered "respectable" in conservative Isfahan.

"Some of the animosity toward Americans these days has been Iranians' paying back scores," an official here said. "One man had his car burned three times while his neighbors' were untouched. There's a correlation in Bell Helicopter between people who have been the target of such incidents and people with court cases outstanding."

Over the past two months, 47 cars belonging to U.S. citizens have been firebombed by Isfahanis who have personal or political grudges against Americans, officials say.

The animosity already has forced about 1500 Americans to leave Isfahan since antigovernment disturbances erupted here in August. An additional 1,500 who were supposed to come have decided not to, leaving the American population here, at about 9,000.

Given the unrest, official U.S. evacuation plans have been updated in recent months. Contingencies cover everything from flights out on normal commercial planes to an emergency airlift by U.S. Air Force transport "I don't think it will come to that," an American said. "But I wouldn't be surprised at a contiuning reduction of the American presence here."