Convinced that final victory against the invading Iraqi Army is within it grasp, Iran has begun to emerge from largely self-imposed isolation by seeking to expand its influence with the West and pro-Western countries of the Middle East.

Voicing anti-Soviet as well as traditionally anti-American sentiments, the government is seeking to pose as an anticommunist bulwark capable of ensuring the free flow of oil to the West and Japan and of keeping the Soviets away from the Persian Gulf.

The new trend first became apparent during the winter, when Iran dispatched more than 25 missions throughout the world--but significantly to Western Europe--to improve the revolution's image.

In addition to seeking to burnish its image, Iran has moved to improve ties with its staunchly anti-Soviet neighbors Pakistan and Turkey and has signed trade deals with both countries, including a major pipeline project with Turkey.

The Iranians also have looked to the Arabs within the Persian Gulf area, who have been frightened that Iran's Shiite Islamic revolution could spread throughout the region to unsettle their own governments and who have supported Iraqi President Saddam Hussein during his government's 19-month-long war with Iran. Recently Iran sent a business representative to the United Arab Emirates.

Iran's new campaign apparently has caught Soviet attention. Last month the Soviet Communist Party newspaper Pravda complained that "right-wingers" around Khomeini were unfairly equating the Soviet Union with the United States despite the Kremlin's best efforts to help Iran and improve bilateral relations.

But Islamic Republic, the newspaper of the ruling Islamic Republican Party, recently wrote, "Let's not forget that in the course of the war, the Soviet Union has spared no aid to Saddam" Hussein, and it charged that the Kremlin was still providing Baghdad with military aid.

The trade deals signed during the past month with Turkey and Pakistan signaled a change in Iranian policy. Previously both countries had been distrusted by Iran because Turkey was a member of the North Atlantic Treaty Organization and Pakistan, which has been highly critical of the Soviet invasion of Afghanistan, accepted massive aid from the United States, still considered here the "Great Satan."

The change in Iranian policy, diplomats here said, was dictated only partially by a need to unload its oil in barter deals. The Turkish accord, according to these diplomats, was designed especially as a signal to the West that Iran was willing to play down its revolutionary scruples and deal with Islamic neighbors with ties to the West.

Emphasizing that message, the diplomats contend, was the part of the deal calling for the construction of two ambitious pipelines, one to transport Iranian crude to the Mediterranean and the other to provide Iranian natural gas to Turkey, then Greece, Yugoslavia and Italy.

The financing of such a multibillion-dollar venture--given the shaky finances of Turkey and Iran--makes its immediate execution questionable, diplomats noted. But they said that any such gas pipeline would tie Iran into long-term commitments with the West.

By the same token, the pipeline projects would appear to lessen the dependence of Iran and Western Europe on the now-interrupted arrangement whereby Iran supplied the Soviets with natural gas and Moscow then sold its own gas to Europe at a higher price.

That Iranian-Soviet deal fell apart soon after the revolution, when Iran stopped deliveries, complaining that the Soviets were not paying enough.

Besides the pipelines, the deal provided Turkey and Iran with political advantages. According to observers here, Turkey provided "total assurances" that its territory would not be used by exile forces to invade Iran, and in return Turkey expected that the improved relations would help guard against potential Islamic subversion by Iran.

In its campaign within the Persian Gulf region, Iran recently sent Ali Naghi Hamouchi, the Chamber of Commerce president, to the United Arab Emirates. Sheik Zayed ibn Sultan Nuhayan of Abu Dhabi, one of the most important leaders there, is constantly praised by Tehran as pro-Iranian. This constrasts with Bahrain, Kuwait and Saudi Arabia, where nervous rulers worry about the influence of the Iranian revolution on their restive Shiite Moslem populations. In Bahrain, 73 Shiite Moslems are on trial charged with seeking to overthrow the ruling Khalifa family in the name of Iran's Islamic revolution.

Behind the new Iranian campaign lies an obvious message containing just enough of an implied threat of potential troublemaking to the weak and worried gulf states to be highly effective, diplomats here said.

Western and Third World diplomats here are convinced that the oil-producing gulf states, fed up with paying $24 billion to Iraq to help support the war effort, are actively involved in seeking to ease Saddam Hussein from power.

Perhaps as a result of such pressures, Iraq apparently has acceded to all but one Iranian demand for ending the war.

Iraq, according to key diplomats here, is willing to withdraw its troops from Iran, accept international arbitration tantamount to admitting its aggressor role in starting the conflict, pay reparations and accept the prewar land boundaries.

But Baghdad is still believed by those diplomats to be demanding negotiations on the sovereignty of the Shatt-al-Arab estuary leading to the Persian Gulf.

Until 1975 Iraq enjoyed sovereignty over the entire body of water, but was forced then by the shah, Mohammad Reza Pahlavi, to share it with Iran.

During his peacemaking efforts here in February, former Swedish prime minister Olof Palme, according to diplomats, offered between $30 billion and $68 billion on behalf of the gulf states.

Khomeini reportedly has accepted the principle of such payments but insisted that they be made by Iraq to rub in Baghdad's humiliation.

At this point, the smaller states' principal worry is said to be less that of subversion--for Iran's economic problems of the past three years have made the Islamic revolution less attractive to many in the gulf--than the more immediate fear that their largely artificial boundaries could disappear in any major invasion.

The pro-Western governments are counting, perhaps optimistically, on a compromise solution in Iraq. Diplomats and analysts argue that it is in Iran's interest to keep Iraq from succumbing to a major bloodletting and anarchy in the event of Saddam Hussein's overthrow.

The feared Arab world domino theory of one Persian Gulf government collapsing after another after such an upheaval could only benefit Israel, these analysts argue. And Khomeini as a sworn enemy of the Jewish state should have no interest in helping it expand its influence on the ruins of Middle East governments, they say.

Possible complications abound, such as an Egyptian option to send troops to bolster Iraq, these analysts add. If successful, such a move would smooth Egypt's way back into the Arab world without jeopardizing its peace treaty with Israel, they say.

But, if Iran prevailed, nonetheless, the defeat of Egyptian troops would only precipitate the domino-theory scenario of general collapse, they say.

So far, Iran has given contradictory signals about its plans, sometimes saying the Iraqis should decide their new order and sometimes advocating an extension of yet another of the Islamic republics Khomeini wants established throughout the Islamic world.

However, on the basis of past performance, observers argue, Khomeini is likely to push ahead for yet another decisive battlefield victory, which could smash the Iraqi Army, overthrow Saddam Hussein and install a carbon-copy Islamic republic in Baghdad.

President Ali Akhbar Khamenei recently said, "There is no geographic border for the imam," as Iranians call Khomeini.

But other Iranians are said to realize that such an Iranian presence in Iraq could secrete powerful Iraqi nationalism capable of backfiring on Iran.

So far Iran has not invaded Iraq yet, although various religious and military leaders have advocated such a course, and many analysts believe they will do so out of revolutionary inertia.

"We will advance toward Kerbala, in the near future," announced Mohsen Rezai, commander of the Revolutionary Guards recently, referring to the main Shiite Moslem shrine in Iraq.

Iran reportedly has held back a move across the border in an effort to deprive Baghdad of a last-minute argument to rally the gulf countries. The temptation would be especially strong if the invasion took place around Basra in the south near the Iranian-Iraqi-Kuwaiti borders.

However, an Iranian thrust farther north, around Qasr-e-Shirin, observers here said, is more likely, since it would draw Iraq's remaining strategic reserve to defend the capital, which lies barely 100 miles to the southwest.