Hundreds of angry residents of a working-class Queens neighborhood, led by 35 who lay down in front of two chartered buses, last night prevented 70 Iranians just freed from federal prisons from returning to Washington for another anit-American demonstration.

When police ordered the buses to turn around and leave without the Iranians, the crowd, which had thrown eggs and shouted anti-Iranian epithets, cheered, waved American flags and popped open cans of beer, signaling the start of a victory party.

Shortly after midnight, Mayor Edward Koch and Donald McHenry, U.S. ambassador to the United Nations, arrived on the scene and offered to provide buses from the New York Transit Authority. Lawyer Mark Lane, representing the Iranians, refused, saying he wanted New York officials to make the area secure so the Iranians could provide their own transportation.

About 250 helmeted police, some called in from Brooklyn, Bronx and Staten Island, managed to push the crowd back about one block from the entrance to the mosque, which is on Queens Boulevard between 51st and 52nd streets. But Lane said that the crowd was "still within rock-throwing distance" and that the Iranians would not leave until the local residents were out of sight.

After talking with the mayor and the ambassador for about three minutes in the doorway of the mosque, Lane turned his back on them and went inside.

Koch then appealed to 300 or so residents who were standing across the street to "go home," telling them their presence was "counterproductive."

But then Koh told reporters that "they [the neighborhood residents] are angry and frustrated, and they have an absolute right to stay on that corner." He also noted that "we can't tell them [the Iranians] to leave the building."

The mayor said the Iranians "are creating an incident and they would like us to enlarge on it, which we will not do . . . I may not like them, but I don't like lots of people."

By 2 a.m., police had pushed the crowd, which had dwindled to about 50 people, at least two blocks from the mosque. With the street cleared, about 10 Iranians left the mosque and eode off in two taxis.

Since early yesterday afternoon, residents of Woodside -- a neighborhood one man boasted was "Archie Bunker territory" -- had milled outside the red brick building where the Iranians had gone to pray following their release from two New York prisons on Tuesday.

The inability of the Iranians to get out of the one-story building, which had been converted to a mosque from a warehouse without the knowledge of nearby residents, threatened to postpone demonstrations planned in Washington today and Friday.

The Iranians, who were arrested in a violent July 27 demonstration in Washington, had planned to leave the mosque in early afternoon. But they were stranded when drivers of two chartered buses refused to allow them to board, saying they feared for the safety of their passengers and themselves. t

At that time, the crowd consisted largely of about 100 reporters and members of television camera crews and police. But that scene apparently intimidated the drivers, who thought they were going to drive a church group to the nation's capital because the buses had been ordered by the United Methodist Church.

As the work day ended for neighborhood residents, the crowd grew, reaching 1,500 by 10 p.m., about an hour after police turned a second set of buses away in the face of a jeering crowd.

An arrest occurrred shortly after those buses retreated, when a man in an orange T-shirt and blue jeans threw a bottle at Lane, who was standing in the doorway of the mosque.

Lane called to police to "charge that man with attempted homicide," as police wrestled the bottle thrower to the ground.

Nearby, however, the mood was festive. Copies of a revolutionary Iranian newspaper were used to fuel a bonfire, as scores of persons burst out singing "God Bless America."

Lane, who was not hurt, refused an offer by a police captain to move the Iranians to Kennedy Airport, saying that if police couldn't control the crowd, "I will bring in large numbers of Palestinians from Brooklyn to clear the street."

The crowd booed, jeered and popped open more beer.

The Iranians, who were among 192 released from federal custody when they ended a 10-day silence and gave their names to U.S. immigration officials, were held virtual prisoners again, this time inside the mosque.

A few attempted to dash to the nearest subway station, two blocks away. "Two made it, chased by the snarling crowd. Another had to be rescued by a huge man in the crowd who picked up one of them shouted "I'm trying to save your life, you dumb. . . .," and tossed him into the arms of a policeman.

In Washington, Bahram Nahidian, an Iranian rug dealer who was coordinating the latest demonstrations there, said today's march might have to be postpone because it was being staged in part to honor the students who had been arrested July 27.

Police in Washington were gritting their teeth and preparing for the anti-American marchers. While charges of disorderly conduct and threats of deportation had been dismissed against the Iranians arrested on July 27, the D.C. police department is investigating charges of police brutality lodged by those students.

Spokesmen for both the D.C. and U.S. Park police departments said their biggest fear was that Americans in Washington, like those in Queens, would disrupt the street marches of the Iranians.

Although many of the Iranian students remained trapped in New York, about a dozen returned to Washington earlier yesterday by private cars, and were greeted like conquering heroes when they entered the Islamic House at 5714 16th St. NW.

The violence last month erupted between opposing Iranian factions. But all the Iranians planning to demonstrate here today and tomorrow are supporters of Ayatollah Ruholloh Khomeini, so police see the main threat coming from the growing American resentment toward the foreign protesters.

One veteran Washington police official said he had not seen so much antagonism or intensity of spirit by Americans since World War II.

He said that while police are experienced in dealing with "screwballs" who atempt to disrupt nearly every demonstration, "in this case we are not talking about crazies, but people in the mainstream, reasonable people just want to get a crack at these people, and that's new."

Larry Melton, vice president of the International Brotherhood of Police Officers, which represents the rank-and-file D.C. police, said officers "are stuck in the middle again."