A federal judge here last night blocked a major Carter adminstration attempt to ban virtually all Iranian-related public demonstrations in Washington during the tense hostage situation in Tehran.

U.S. District Court Judge Aubrey E. Robinson issued the ruling despite urgent testimony by Deputy U.S. Secretary of State Warren Christopher that protests in this country might provoke the Iranian captors of the U.S. Embassy in Tehran into harming the 62 American hostages.

A public demonstration "could be the catalyst for a very tragic situation," Christopher said. He urged Judge Robinson to block a planned demonstration here Tuesday by a group of American and possibly Iranian students who say they want to march to promote peace and understanding between U.S. and Iranian citizens.

But Robinson, accepting the arguments of the American Civil Liberties Union, which brought the issue into court, ruled that the government had not made a sufficiently direct connection between protests here and potential violence in Tehran to justify any ban on demonstrations.

"Without a very substantial showing of inevitable direct and irreparable harm to those held hostage in Iran," Robinson said in his carefully worded order, "the uniqueness of the present diplomatic situation in Iran does not justify the prior restraint challenged by plaintiffs, a substantial infringement of their First Amendment rights."

Robinson stressed that his ruling dealt directly only with the planned Tuesday march and his belief that police will be able to control any violence that might arise from it.

Government attorneys said they will appeal Robinson's ruling this weekend.

Anti-Iranian feeling is already running high here, and Carter administration officials are fearful that television and newspaper reports reaching Tehran of Iranian nationals injured in any attacks here could trigger retaliation against the American Embassy hostages there.

Just last Friday, Iranian Moslem demonstrators marching through downtown Washington were jeered by businessmen, construction workers and other passersby. Some of the marchers were pelted with eggs. Police formed a human wall around the demonstrators to prevent possible attacks.

American students have protested noisly at the Iranian Embassy and nearby Islamic Center on Massachusetts Avenue, Nw, shouting epithets at Iranians and even persons who looked Iranian.

Top Carter administration advisers met with Mayor Marion S. Barry last week, urging him to curtail permits for Iranian related demonstrations.

D.C. police, Secret Service and Justice Department officials have also been meeting intensively with State Department representatives, analyzing the potential for violence in a number of demonstrations requested by various pro- and anti-Iranian groups.

Capitol Police and U.S. Park Police had revoked permits for two demonstrations last week and one this week, citing a "clear and present danger" provision of federal regulations.

When President Carter's top advisers met with Barry last week, they made it clear Carter was concerned not only about possible violence but also about television broadcasts picturing Iranians encircling the White House, the symbolic heart of America.

Barry, a former civil rights leader who had been active in demonstrations himself, resisted the White House pressure, however, and granted a permit to the Moslem student group last Friday.

The issue centered on balancing First Amendment rights of free speech and assembly with the need for public safety. Barry's advisers, including general assistant Ivanhoe Donaldson and Corporation Counsel Judith Rogers, argued that the White House had not made a convincing case that uncontrollable violence would occur at the march and urged issuance of the permit.

Barry attended the Moslem march, riding behind it with D.C. Police Chief Burtell Jefferson. He said he granted the permit in part as a tactical move since he believed the militant demonstrators would march anyway. He was jeered by bystanders along the way, and his office received numerous calls protesting the granting of the march permit. That night, Barry canceled permits that would have allowed the demonstrators to continue throughout the weekend.

The American Civil Liberties Union filed the suit yesterday on behalf of the members of a local group calling itself Students Opposed to Violence. The ACLU argued that the Carter admnistration's ban on all demonstrations concerning the Iran situation was unconstitutional. Federal attorneys argued yesterday tht there is no such total ban, but conceded they would revoke the permit for the Tuesday march unless the marchers agree to protest somewhere other than the White House and Lafayette Square areas.

Assistant U.S. Attorney Royce C. Lambreth had argued that the hostage situation is unprecedented in American history and the government regulations of demonstrations, normally given strictest First Amendment protection by the courts, should be viewed in that context.

Christopher agreed. Questioned by Assistant U.S. Attorney R. Craig Lawrence, he said, "There is nothing parallel to this in our experience. (It) violates all norms of international law."