Militant Iranian Moslems went on a rampage in Tehran today seeking retribution for bloody street battles with lefists Sunday, while the revoluntionary authorities cracked down strongly on their political opposition.

Tehran was tense throughout the day as bands of Islamic militans ran through the streets brandishing sticks, iron bars and rubber hoses at students and youths they denounced as "nonbelievers and communists."

The Moslem mobs ransacked the Marxist Fedaye guerrilla headquarters, stormed the Tehran University law school and a campus library and attacked several offices of leftist groups.

Bursts of gunfire were frequently heard during the day as Revolutionary Guards loyal to Moslem leader Ayatollah Ruhollah Khomeni fired in the air to disperse unruly crows. The guards had been dispatched to trouble areas by the government, which announced it would provide security for future demonstrations following street battles Sunday between Moslem militants and leftist protesters.

However, few leftists appeared on the streets today, and there were few reported casualties as the Moslem militants attacked leftist targets.

Meanwhile, Iran's crackdown on the press was extended to foreign correspondents in a new 14-article code issued today by the deputy minister of national guidance.

The code, regulating the activities in Iran of both visiting correspondents and Tehran-based journalists accredited to foreign publications, comes a day after the government began to enforce a domestic press law providing for up to three years' imprisonment for "insulting" Iranian clergymen. The law and the closure of several independent Iranian newspapers sparked Sunday's protest march, which degenerated into rioting.

One of the articles holds a resident correspondent responsible for any report his organization publishes that is deemed "false, distorted or motivated against Iran's Islamic revolution, government or nation." The clause adds that the reporters in Iran will be prosecuted "according to the relevant laws."

Another clause says that foreign correspondents visiting Iran must, when obtaining a visa or upon arriving in Iran, take an oath swearing to "write nothing but the truth and desist from fabricating news, spreading rumors or causing discord and suspicion."

Other regulations say that foreign correspondents cannot interview government officials unless accompanied by a "guide" from the Ministry of National Guidance and that journalists who want to visit Iran for more than 15 days must apply at Iranian embassies in their own countries two months in advance.

Journalists judged to have violated the code are subject to penalties. The code does not specify any, but it says the reporter will be liable to prosecution under existing Iranian and international laws in addition to losing accreditation for himself and his publication.

As the new rules - stricter than any applied by the former government of Shah Mohammad Reza Pahlavi - were being released, Iran's revolutionary authorities began an apparent crackdown on political activity by dissidents critical of the country's new Islamic rulers.

A warrant reportedly was issued for the arrest of a leading liberal politican and lawyer. Hedayatollah Martin-Daftari, a grandson of the late prime minister Mohammed Mossadegh.

Matin-Daftari's National Democratic Front organized Sunday's march to demand freedom of the press.

The Front has been accused by the revolutionary authorities of deliberately planning the resulting clashes "to divide the country."

The Front closed its office today, and neither Matin-Daftari nor other members of its executive committee appeared in public. A spokesman said the office had been closed in case Moslem militants tried to attack it.

The militants began their rampage in the morning when they occupied the Marxist Fedaye headquarters and made bonfires of all the documents they could find inside.

The Fedaye organization already had gone underground, and only a skeleton staff was present when the mob attacked. The staffers ran out a back exit and fled on motorcycles.

The Moslem attackers were eventually evicted by revolutionary militiamen who occupied the guerrilla headquarters. Tehran Radio said they discovered an arms cache inside.

The militiamen at the captured building had to fire in the air continuously to prevent clashes between Moslem groups and Fedaye supporters staging a sit-in outside.

The headquarters of the Trotskyist Socialist Workers Party and the pro-Moscow Tudeh Party also were attacked by Moslem mobs.

At the university the Islamic militants ran through the law school tearing down posters and ripping apart books.

But the most violent scene at the university occurred late in the afternoon when about 50,000 pro-Kohmeini demonstrators marched there to protest yesterday's rioting.

The marchers attacked several bystanders whom they accused of having taken part in Sunday's antigovernment march. One group of about 50 militants began beating two girls who were not wearing the traditional veil and were only stopped by the intervention of a Moslem clergyman. CAPTION: Picture, Demonstrators in Tehran shout their support of the Islamic government in a massive march organized to counter a "freedom of the press" rally held on Sunday. AP