A generation ago the United States paid so little attention to these dusty sheikdoms that its only diplomatic representation was a young Foreign Service officer who sailed around the Persian Gulf in an Arabian dhow.

Now international attention is focused on the gulf region, which supplies half the noncommunist world's oil imports and is being subjected to internal threats as a result of the bitter war between Persian Iran and Arabian Iraq, being fought a short jet flight away from the capitals of the sheikdoms.

Here in Bahrain, for instance, wary islanders are stocking up on food for the trouble that might be coming. One family of 12 said they bought enough rice, powdered milk, canned goods and cooking oil to last three months. Diplomats report that some businessmen are shifting funds from banks here to what they regard as safer havens.

Keeping a weather eye on the fighting and the diplomatic maneuvering, area specialists and officials up and down the gulf fear that an Iranian win would bring greater instability to the region as its Shitte followers of Ayatollah Ruhollah Khomeini would be emboldened to demonstrate against the ruling Sunni families of the area's Moslem Arabs.

On the other hand, largely conservative gulf rulers are leery of the untrammeled power an Iraqi victory would give to Baghdad's Baath Party leaders, who until 18 months ago were considered the bad boys of the gulf for their revolutionary policies.

Even a stalemate, considered by many observers to be the most favorable of the likely outcomes, carries with it the increased danger of outside interference, which many gulf states fear, and of a desperation strike by Iran on either the Arab oil installations or the vital Strait of Hormuz, through which most of the oil from this region flows to the rest of the world.

Thus, no matter how the fighting between Iran and Iraq comes out, area specialists and officials of this volatile region believe shock waves from the 12-day-old undeclared war have placed much of the world's oil supply in jeopardy, threatening alike the industrialized Western world, underdeveloped nations of the Third World and the oil kingdoms of the Middle East.

The war also has further disrupted OPEC's pricing structure. It has raised another area of possible conflict between the United States and the Soviet Union, particularly if a U.S.-dominated international fleet moves in to secure the Strait of Hormuz. In addition, the fighting probably had diminished chances for release soon of the 52 American hostages held by Iran since Islamic militants seized the U.S. Embassy last Nov. 4. h

A clear-cut perceived victory by Iran could cause the greatest problems in this region, according to sources here, who believe the gulf states quietly have supported Iraq in the fighting.

An Iranian success could make it even harder for the United States to win freedom for the hostages ironic, since a Tehran victory would in part be due to the U.S. weapons and training supplied while the late shah was in power.

But close observers of Iran's religious-political attitudes said the win would strengthen a sense of self righteousness and dogmatic refusal to accept compromise. This would further weaken the position of secular moderates in their battles with the fundamentalist clergy who now appear to be running the country.

For now, the fighting appears to have strengthened President Abol Hassan Bani-Sadr, who has emerged as the architect of Iran's defenses.

However, observers here believe an Iranian victory would enforce Khomeini's belief that his Islamic revolution carries the special blessing of Allah -- protecting it from America's April attempt to rescue the hostages by throwing up an unexpected sandstorm, but imbuing the Iranian fighting men with a special fervor to beat back the Iraqi attacks.

Those are ominous tidings for the rulers of these gulf states, many of whose subjects are Shites who are seen as receptive to Khomeini's call for support of his revolution.

The Iranians have accused the Sunni rulers of being un-Islamic and over the past 20 months have urged Shites to rise up against them.

During prayer meetings at Tehran University today, a prominent clergyman, Hojatoleslam Mohammed Ali Khamenei, a member of Iran's defense council, accused the gulf states of Bahrain, Kuwait, Saudi Arabia and the United Arab Emirates, as well as Jordan and Egypt, of aiding Iraq and said they must expect Iranian retailiation.

With an Iranian victory, the gulf states would be unable to count on Iraq -- the other major military force in the region -- as a protector.

Furthermore, some analysts here believe an Iranian victory would mean the end of Iraqi President Saddam Hussein's rule and a possible return to Iraq's previous destabilizing posture in the region.

The greatest fear, however, comes from the internal stresses likely to be set off by an Iranian victory, as observers believe unrest within the large Shiite population that is currently under the surface is likely to well up.

Problems probably would be greatest here in Bahrain, where Shiites make up more than half of the population, but those in Kuwait are considered to be more militant while less numerous.

There were mild disturbances in Bahrian when Khomeini wrested power from the late shah in February 1979, but there has been no repetition since and there have been no pro-Iranian demonstrations along the Arab side of the gulf since the Iran-Iraq war.

But any resurgence of Shiite militancy is likely to unleash conflicting pulls among the populations of these gulf states, who will have to balance Arab ties and a traditional antipathy toward Persian Iran against the pull of Shiism.

It is these conflicting ties that make any analysis of the effects of a possible Iranian victory very tentative, area specialists emphasize.

But it appears that it would take a massive pro-Shiite uprising to overturn any of these governments, whose internal security and armed forces are in the hands of loyal Sunnis. Even without the fall of government, however, constant internal stresses can hurt the flow of oil from these countries to the rest of the world.

There are also fears that an Iraqi victory would unleash some form of Iranian attack against either the gulf states' oil facilities or the Strait of Hormuz. One official said he believes the Iranian threats more than he does Tehran's pledge to keep the vital international waterway open.

For such reasons, there are some indications that Arab nations of this region might quietly welcome an international force designed to keep the strait open.

It is unlikely, however, that this welcome would be expressed publicly.