The National Park Service, after its unprecedented refusal to let militant Iranian students demonstrate here last week in the wake of bloody fighting during the visit of the shah of Iran Nov. 15, agreed yesterday to let the students rally in Lafayette Park on Dec. 31 and Jan. 1.

Park service officials said a "sufficient cooling off period" will have passed by Dec. 31, to minimize a recurrence of violence.

The American Civil Liberties Union, which had considered suing the park service for last week's permit denial on constitutional grounds, said it welcomed yesterday's action and was very pleased with it.

The Iranian Students Association in the U.S., one of several student factions involved in the Nov. 15 violence, was granted the permit for demonstrations on both Dec. 31 and Jan. 1, to coincide with President Carter's scheduled visit to Iran.

Student representative Massoud Amini said yesterday the demonstrations - which he said will probably draw no more than 200 persons - have been called to protest continued U.S. support of the authoritarian regime of Shah Mohammad Reza Pahlavi.

When the shah arrived at the White House last Nov. 15 for a state visit, several hundred masked, stick-swinging anti-shah Iranian students attacked a gathering of pro-shah demonstrators on the Ellipse. More than 100 persons, including 28 U.S. Park Police officers, were injured in the melee, one of the most violent here in recent years.

Student organizers publicly deny initiating the violence, blaming it on provocateurs from SAVAK, the Iranian secret police. Privately, several organizers acknowledge that some anarchist elements among the students sparked the fighting.

U.S. Park Police, who deployed only a small detachment of officers, few with riot gear, have been privately criticized by Justice Department and other federal officials for being ill-prepared. Both FBI and State Department security officials said they gave Park Police advance warnings of possible trouble, but the warnings apparently were ignored.

When the Iranian Students Association in the U.S. asked to demonstrate again last week in Lafayette Park, regional park service director Manus (Jack) Fish denied the association's permit application, citing a "clear and present danger to public safety.'

It marked the first time in the memory of park service officials that a political demonstration had been barred on the "clear and present danger" basis.

Fish said he acted at the urging of Park Police and Secret Service officials who contended a "cooling off period" was needed to avert more violence.

The denial brought objections from the American Civil Liberties Union Fund of the National Capital Area and a letter to Interior Secretary Cecil Andrus from Rep. Don Edwards (D-Calif.), a frequent critic of the shah's regime in Iran, who questioned the constitutionality of the park service action.

A spokesman for the park service said yesterday that Fish felt a "sufficient cooling off period" will have passed by Dec. 31 and "there would be no clear and present danger." At a meeting of park service and law enforcement officials yesterday on the Iranian demonstration request, there were no objections from Secret Service, Park Police or D.C. Police representatives to the rally proposal.

While the park service barred the students from Lafayette park last week, D.C. Police allowed a group of about 70 students to march through downtown Washington on Thursday. There were no incidents.

Ralph Temple, legal director of the local ACLU, said yesterday that while the park service was "in error" to deny the park permit last week, "we are not in any way going to condemn them for that action . . . We are very pleased with the (approval of the the Dec. 31-Jan. 1 demonstrations)."

He said last week's permit denial was "an action taken in response to a unique occurrence (extensive violence on Nov. 15), and we don't think (the denial) will constitute a precedent of any kind."