Iran is massing its military forces for what appears to be a full-scale invasion of Iraq, a prospect that is causing "great alarm" here and in several Persian Gulf countries, according to American officials.

White House, Pentagon and State Department officials were in agreement yesterday that an invasion by some 80,000 Iranian troops now forming near the border with Iraq could come within a matter of days.

Depending upon its success, the officials said, an Iranian invasion could topple the government of Iraqi President Saddam Hussein. A victory by the forces of Iran's Ayatollah Ruhollah Khomeini, they went on, also could threaten governments elsewhere in the Persian Gulf with another outbreak of aggressive Islamic fundamentalism, and create serious new diplomatic and security problems in the oil-rich region for the United States and its allies.

American officials said they had no reason not to believe a broadcast on Tehran radio yesterday, monitored in London, that claimed Iran is ready to make a thrust into Iraq to topple Hussein.

Tehran radio said a "grand and historic battle" is in the offing. Based on intelligence reports available here, the American officials said "a very big dust-up" is likely soon.

The Persian Gulf neighbors have been at war since September, 1980, when Iraq invaded Iran and quickly seized control of the disputed Shatt-al-Arab waterway leading into the Gulf and a long sliver of land on the Iranian side of the border in the oil-producing province of Khuzestan. At the time, a quick victory was forecast for the Iraqi forces over the revolution-torn Iranians.

But during the past year, Iran has fought back, badly mauling Iraqi forces in several battles and driving them back to the border. Now, the Iranians are poised to push into Iraq. American officials said the Iranians have brought in bridge-building equipment and withdrawn a number of divisions from their normal positions to the north along the Soviet border to take part in an assault.

Intelligence information indicates the Iraqis have close to 100,000 troops arrayed against the Iranians, giving the defenders some numerical advantage. Because the Iraqis would be fighting for their own homeland, they might fight more effectively now.

But American officials said the intelligence information also indicates that Iraqi readiness has been poor in comparison to the Iranian efforts. They said there are holes in the trench line dug along portions of the 700-mile border, and that morale continues to be low among Iraqi soldiers.

Sources here believe the main first objective of the Iranian assault would be Basra, a key Iraqi oil port. Some U.S. officials believe taking Basra and some other key points might be enough to topple Hussein and avoid pressing on to the Iraqi capital of Baghdad.

But other analysts say the Iranians may be more interested in money than in toppling Hussein. The Iranians, citing the damage to their country and oil facilities done by Iraqi forces, have demanded $150 billion in reparations as part of the price for any nonmilitary settlement. In the view of some specialists, the seizure of Basra and perhaps a few other places could give Iran the leverage to force a favorable settlement.

Moderate Arab states such as Saudi Arabia, Kuwait, the United Arab Emirates and Qatar--all of which have reason to fear a Khomeini-inspired revolution by Shiite Moslems--have already pumped more than $25 billion into Iraq's war effort and perhaps would pay out more to get a settlement that would forestall further revolution, some officials here believe.

Late yesterday in New York, the U.N. Security Council unanimously adopted a resolution, acted on at the request of Iraq, calling for an immediate cease-fire in the 22-month-old war.

The resolution, passed by a 15-to-0 vote, also calls for withdrawal of both armies to "internationally recognized boundaries," the dispatch of U.N. observers to verify the disengagement and mediation efforts to settle the crisis.

Iraq, facing a possible defeat on the battlefield, has been urging an end to the fighting recently and announced last month that it was withdrawing its forces from Iran. The Iranians, however, have flatly rejected any U.N. actions to end the dispute, since the U.N. made no effort to intervene when Iraq had the upper hand, Tehran claims.

For the United States, a successful Iranian invasion "will complicate things badly," as one official put it, especially if it comes with the war between Israel and the Palestine Liberation Organization still raging around West Beirut.

In the view of some administration officials, an invasion would give the Soviets an opportunity to shift at least some support to Iran and put the United States in the awkward position of perhaps having to back Iraq, a country with which the United States does not have formal relations.

Because Saudi Arabia and most other Gulf states "are very frightened" over the prospects of a reemerging and militarily dominant Iran under Khomeini, an official said, the Iranians might demand that the Saudis and others put some greater distance between themselves and the United States as the price for peace in the region.

The American support for Israel at a time when Arabs are being killed in Lebanon might make it harder for the moderate Arab states to resist such pressures, some officials speculate.

On the other hand, there are specialists who take a less alarming view of the potential results, even of a successful Iranian assault. They believe the invasion could drive the moderate states even closer to the United States as it becomes clear that some protection from Iran ultimately will be needed.

They also believe that it is far from clear that Iran will allow the Soviets to play an influential or important support role.

The Soviets have a longstanding treaty of friendship and cooperation with Iraq. But Moscow has also moved to try and improve relations with Iran lately and has reportedly sold Tehran some spare parts for armored vehicles.

The Soviets, American officials say, have been skillful in their dealings with Tehran and are undoubtedly trying to position themselves to take advantage of any situation after Khomeini's rule ends.

But there is still considerable mistrust of the Soviets in Iran, and these U.S. officials doubt the ultimate ability of Moscow to have a truly influential role.