Iran today announced a major oil deal with Romania and said that agreement had been reached for the transportation of goods through the Soviet Union if the United States imposes a naval blockade.

The Iranian government has been inching toward closer relations with the Soviet Bloc in the face of possible Western trade sanctions and the threat of a military blockade of the Country's Persian Gulf port by the United States in punishment for the continued detention of American hostages at the U.S. Embassy.

The sale of 100,000 barrels of oil a day to Romania represents a 60 percent increase over previous Romanian purchases. Iranian Oil Minister Ali Akbar Moinfar said the sale was at Iran's full $35-a-barrel price, but oil analysts here were skeptical because of recent resistance by customers to paying Iran's newly increased prices.

The agreement on a draft protocol with the Soviet Union, which must be endorsed by the ruling Revolutionary Council before it can take effect, was publicized here in an apparent effort to frighten the West away from tougher economic sanctions against Iran.

Given the Islamic Republic's inbred animosity toward communism and its penchant for exporting an Islamic revolution, the movement toward Moscow has been made with some reluctance and has not yet translated into any political rapprochement with Moscow.

The closest political move toward the Soviets was an announcement today that an agreement had been reached on diplomatic relations with South Yemen, the only Arab Marxist country and a staunch ally of Moscow.

But evidence of the government's inconsistency on its ties with the communists has been a crackdown on Iranian leftist groups this week that has resulted in serious clashes on college campuses and provoked outbursts of civil unrest.

The announcement of the protocol came at the end of a 10-day visit by a Soviet trade delegation. Iranian Finance Minister Reza Salimi said the two countries had "drafted an important protocol for economic and industrial cooperation," the oficial Pars news agency reported today.

Salimi said that U.S. economic sanctions against Iran would not adversely affect the economy because the government had reached agreement with Moscow on transporting goods to Iran via the Soviet Union in the event that the United States closed Iran's southern waterways.

He added, "If any countries should follow the U.S. sanctions against Iran, we will purchase what we need from the East European countries and the countries that do not follow the sanctions against Iran."

The finance minister gave no details of the draft protocol with the Soviets, but he said negotiations on the price of Iranian natural gas previously exported to the Soviet Union had yet to be concluded. He said he hoped that an early agreement would be reached, enabling Iran to resume the gas exports through an international pipeline. Iran halted the exports in early March when price negotiations broke down after Iran had demanded a five-fold increase.

The Soviet formerly purchased about 28 million cubic meters a day of Iranian gas for an annual cost of about $250 million. Before the negotiations broke down, however, the volume of gas imports had dropped to about 15 percent of the contracted amount.

Another key item in the Iranian-Soviet trade agreement is expected to be a formal pact allowing Iran to use three major transit points on the border between the two countries at Julfa, Astara and Bandar Anzali.

Moinfar said more announcements of oil sales may be made shortly and hinted that Bulgaria was considering an oil deal with Iran.

Increasing East European interest in trade here has been evident in recent weeks in escalated deliveries of food and other goods from Bulgaria, Poland, East Germany, Hungary and Romania.

However, a Foreign Ministry spokesman was careful to point out today that "commercial relations do not mean we are moving closer politically" to the Soviet Bloc. A key aide of a Revolutionary Council members said, "This government would like to avoid reacting to the crisis with the West by a sharp tilt in the other direction."

Nevertheless, Iran appears willing to take whatever friends it can get, regardless of ideological differences.

But differences among factions inside Iran continued to stir unrest today. A crowd of about 10,000 people gathered at a Tehran hospital to protest the deaths of leftist university students killed two nights ago while resisting efforts by Revolutionary Guards and crowds of Moslem fundamentalists to evict them from their campus offices.

Although officials said six persons died in the violence, protesters claim that as many as 25 people were killed.

Some protesters held up signs and banners saying "Death to Khomenini" and "Life was better under the shah," witnesses said.

It was not the first time since the February 1979 revolution that ousted the shah, Mohammad Reza Pahlavi, that such harsh slogans had been shouted against a government that has grown increasingly intolerant of opposing political groups. But the crowd's brazenness appeared to signal a greater willingness to confront the supporters of revolutionary leader Ayatollah Ruhollah Khomenini, who can still command strong support to overwhelm his opponents.

The demonstration in front of the hospital soon degenerated into rock throwing and fighting between the protesters and Khomeini supporters, some armed with chains and spades. Revolutionary Guards intervened to break up the fighting, but no shots were fired.

In the northwestern city of Tabriz where militant Moslem students began their campaign to purge universities of leftists last week, armed men reportedly surrounded the television station and government offices and demanded entry, but their names and affiliations were not immediately clear. Violent clashes were also reportedly continuing between Kurdish guerrillas and the Iranian Army.

In the rebellious province of Kurdistan in Western Iran, the Kurdish guerrillas were besieging Army troops in an officers' club in the provincial capital of Sanandaj for the third straight day. Clashes also were reported in other towns and villages. An Iranian newspaper said that 150 houses in the Kurdish village of Saqqez had been destroyed by mortar fire. The paper said that as many as 40 persons were killed or wounded in the Sanandaj fighting, in which rockets, mortars and artillery were used.

The renewed fighting between government forces and autonomy-seeking Kurds developed earlier this month when Iran responded to border skirmishing with neighboring Iraq by trying to reinforce troops along the border strip. The Kurds saw this as a government attempt to use the dispute with Iraq to consolidate Tehran's grip on the region.