About 2,000 angry Iranian women today protested an order from Ayatollah Ruhollah Khomeini that all female government employes wear "modest Islamic garb and cover their heads."

Eight women were arrested, but there were no reports of violence in the three-hour demonstration. The potential for trouble was great as the women, dressed in mourning black, faced an equal number of jeering militant Moslem men in front of the offices of President Abol Hassan Bani-Sadr.

The government radio tonight ran a strong warning to the women to "return to the arms of the nation." Few of the women demonstrators were optimistic that they would be able to avoid hejab, the Persian word used to describe modest Islamic dress for women including a head covering or the full-length veil called the chador.

As one wealthy westernized resident of north Tehran said, "There are 30 million of them," meaning the mainly poor people who support Khomeini fervently, "and only 5 million of us."

The demonstration was a rare case of middle-class Iranians taking action, albeit limited, over their growing disenchantment with the revolution. Meanwhile, Khomeini increasingly seems to ignore the country's growing economic problems and instead seeks to revitalize the revolution through religious fervor and sentiment against the shah and the United States.

The protest today was virtually a case study of different sexual attitudes and of the divisions between the elite and the sparsely educated masses, a gap that widened sharply during the reign of the deposed Mohammad Reza Pahlavi. The women were mainly wealthy or middle class and much better dressed than their jeering opponents.

There was only one thing that most of the demonstrators both for and against hejab seemed to agree upon: the United States was at fault.

One militant man said, "The imperialistic hand of America is being used to divide us." Such is the confused state of Iranian politics that another man even maintained that Bani-Sadr, a frequent critic of the United States, was an American.

A militant woman said, "We're in a hell of a situation. Tell the United States to do something -- they got us into this."

Government ministries have given varying interpretations of what Khomeini has called upon the women to wear -- anything from a simple scarf and long sleeves to baggy pants, a long tunic and head scarves.

Many women fear that the dress code is just the first step in what they regard as an antifemale campaign.

"If today we are told to wear the scarf, tomorrow, they'll tell us not to work. It is the first step to pushing us out," said a woman who said she ran a book shop.

"Next you can't drive a car, and then they'll say you must just stay in the house," she added.

The demonstration took place in central Tehran outside Bani-Sadr's office and just across the street from the palace where an unsuccessful assassination attempt against the shah occurred 15 years ago.

The women, most wearing black to mourn their "loss of freedom" and disdaining any head covering, lined the sidewalks. The men occupied the middle of the street, blocking all traffic.

The women chanted, "We haven't carried out a revolution to go backward." The men shouted back, "The shah is your supporter; death to the heritage of Pahlavi."

Many of the militant Moslem men said the women were rectionaries supporting the United States. The women, protecting their political credentials, shouted back: "Our women are awake. They detest the United States. Death to America."

Many of the women appeared frightened. A year ago a number of women were injured by militant Moslem men who broke up a women's rights demonstration.

A number of women interviewed earlier in the day said they would not attend the demonstration for fear of being knifed.Giving credence to their fears was the attitude of some of the men, who called them prostitutes who are taking away jobs from men.

A number of the men nodded agreement as one of their number told a reporter, "The government is responsible for kicking out these prostitutes. Otherwise we will kick them out.

"When they are in the office, they don't care about the job. They are just talking about curling their hair and lipstick," he said.

Revolutionary Guards supporting Khomeini frequently prevented reporters from talking with the women, but did nothing to break up conversations with the men or some chador-clad women supporters.

The demonstration finally broke up after Bani-Sadr appealed to both sides to disband peacefully and said he would mediate and answer their questions later.

One militant Moslem woman said sardonically, "He hasn't answered anyone in the six months he has been in office. I don't see why he'd do so now."

The government radio seemed to confirm that tonight, saying that only a "small minority" of Iranian women were "still thinking about a sinful life." a

"The revolutionary nation will decide about them," the broadcast said. "And these parsites will be taken off the body of the nation."