In a politically sensitive development that has government security officials unusually concerned, two opposing groups of demonstrators totaling as many as 18,000 people plan to converge here Nov. 15 to protest or applaud the shah of Iran when he arrives for a two-day state visit.

Attorneys for both factions have been negotiating with the National Park Service and other officials in a scramble for choice spots at which to demonstrate near the White House and across Pennsylvania Avenue NW at Blair House where the shah is scheduled to stay.

At a meeting yesterday, park service officials ironed out a general agreement that would keep the frequently hostile factions physically separated. The "pro-shah" group would have priority locations closer to the White House Nov. 15 when the shah arrives, and similar priority spots would go to the "anti-shah" group Nov. 16 when the shah leaves.

The negotiations come amid accusations by militant anti-shah Iranian students here that the Iranian government is bankrolling various pro-shah groups to come here from Chicago, Los Angeles and other cities where there are Assyrian, Armenian and other Iranian-related ethnic enclaves.

An Iranian Embassy official strongly denied the accusation yesterday.

While anti-shah demonstrations often have been mounted by Iranian students and their supporters here in the past, the Nov. 15-16 demonstrations mark the first time that any sizeable pro-shah groups also will be present.

Law enforcement officials have expressed concern that a possible confrontation between the two factions is an added complication amid already heavy security measures surrounding that shah and his entourage.

The Secret Service, which had four agents at yesterday's park service meeting, has invoked the so-called 500-foot rule around Blair House. The rule prohibits demonstrations within 500 feet of an embassy or other building used by a head of state.

This will have the effect of closing about half of nearby Lafayette Park to demonstrations and curtailing the number of demonstrators on the sidewalk in front of the White House.

Similar restrictions were imposed in June, 1973, when a state visit by Soviet leader Leonid I. Brezhnev attracted 10,000 demonstrators protesting Jewish emigration policies of the Soviet Union.

For the Nov. 15 demonstrations, the park service tentatively has agreed that pro-shah demonstrators will be allowed on the sidewalk in front of the White House and in a central portion of the Ellipse where the shah is expected to arrive by helicopter. Anti-shah demonstrators will be restricted to Lafayette Park, the eastern periphery of the Ellipse and other more distant points.

On Nov. 15, when the shah is scheduled to leave the Ellipse by helicopter, these positions generally will be reversed with anti-shah demonstrators on the sidewalks and central Ellipse.

Each faction has told park service officials to expect 7,000 to 9,000 dem- consists primarily of locally based demonstrators.

Leadership of the anti-shah group members of three or four factions of the Iranian Student Association.

Marxist and "anti-imperialist" in orientation, many of the student demonstrators wear paper masks during their protest marches, claiming they fear reprisals by SAVAK, the Iranian secret police organization.

The applicants include clubs and organizations from Chicago and Los Angeles as well as a group called the Hossaini from Germantown, Md., and another called the Iran America Friendship Society of Washington.

A spokesman for Atour Travel Agency in Chicago said yesterday that at least 3,000 Iranian ethnics and other supporters plan to fly to Washington Nov. 14 for the demonstrations.

Iranian Embassy officials deny any role in organizing the pro-shah activity.

Jack L. Heller, an attorney, representing pro-shah groups at the park service negotiations, said he has had little contact with the embassy and is being paid by the groups.

Heller said the Iranian groups hired him because "I've done work for other embassies, and I represented some Iranians in insurance cases."

Anti-shah organizers accused U.S. government officials at the park service meeting of favoring pro-shah groups to minimize claims of political repression against the shah during his visit.

Rick Robbins, an Interior Department attorney representing the park service, said the government "has bent over backward to be fair" in alloting demonstration space for the opposing groups.