Mounting fear of Iranian-inspired subversion, prompted by an alleged plot late last year against the ruler of Bahrain, has thrust internal security to the forefront along the Arab side of the Persian Gulf.

One result, in the view of some observers, could be a greater readiness among the governments of this oil-rich and strategically located region to accept closer military cooperation with the United States. But there is also considerable apprehension among the gulf Arabs about too close an association with the superpower that has publicly asserted its desire for a strategic alliance with Israel.

Saudi Arabia is already under attack in various Arab quarters for agreeing this month to establish a joint military committee with the United States. The criticism has raised serious questions about whether the Saudis or any other Arab country in the Persian Gulf region can afford a policy of overt ties with Washington in the present political atmosphere.

"All this talk in the United States about protecting the gulf is embarrassing to the people here," said a non-American Western diplomat based in Abu Dhabi, capital of the United Arab Emirates. "The United States is a friend you would prefer not to admit is a friend, or at least a close friend."

Concern about revolutionary Iran's intentions in the region intensified in mid-December with an alleged Tehran-backed attempt to provoke chaos and presumably overthrow the ruling Khalifa family of this island nation.

Bahrain's information minister, Tariq Moayyed, said in an interview that 60 Iranian-trained terrorists were arrested here and were "part of a much bigger group infiltrating into other gulf states."

He indicated that other members of the group had been rounded up elsewhere without publicity, but he refused to say in which countries.

Those arrested here included 45 Bahrainis, 13 Saudis and one person each from Oman and Kuwait. All were trained in sabotage, terrorism and assassination in Iranian camps and had been issued Bahraini police uniforms made in Iran, Moayyad said.

"There are always dissatisfied elements," said Moayyad, "but what happened here in December was really different insofar as it was straightforward interference from outside."

Precisely what the plotters intended is still unclear but the goal seems to have been an Iranian-style Islamic revolution and the end to the Khalifa dynasty, which has ruled here since 1783.

"I am convinced it was a serious attempt to create chaos, if not immediately a coup d'etat," a well-placed Western diplomat said.

The conviction that the revolutionary regime of Ayatollah Ruhollah Khomeini intends to try again to undermine the Arab monarchies has accelerated joint defense and security planning by the six-nation Gulf Cooperation Council, which was formed last May and held its first defense meeting last month.

The council, which consists of Saudi Arabia, Oman, Kuwait, Bahrain, Qatar and the United Arab Emirates, met again yesterday in Riyadh to consider a Saudi-sponsored plan for a collective security pact to counter the perceived Iranian threat, Reuter reported. At the meeting, Saudi Arabia signed an internal security pact with Oman, making that sultanate the fourth gulf state to agree to a security arrangement with the Saudis.

Besides closer ties with each other, the council's six members appear more interested in increased military cooperation with the United States, implicitly if not explicitly, in the view of Western analysts of gulf affairs here and in Kuwait.

These analysts believe one indicator is the council's changing attitude toward the U.S. military presence and access to facilities in Oman. This was previously a contentious issue within the council, which is formally committed to keeping the region free of superpower rivalry.

The analysts cite as evidence a slight change in attitude by the council's Kuwaiti chairman, Abdullah Bishara, who has been a strong critic of the U.S. presence in Oman but recently has downplayed the issue.

They also note an apparent shift in Saudi Arabia's public acceptance of a greater U.S. role in the region despite considerable risks for the Saudi leadership from militantly anti-American Arab states and movements.

One indication of this was the heated Saudi denial of a Dec. 2 Washington Post story that said the council was trying to get Oman to abrogate its access-to-facilities accord with the United States by offering to finance Oman's military needs.

More recently, the analysts note the apparent Saudi willingness to establish a joint military committee with the United States despite recent pan-Arab denunciations of the Reagan administration at the United Nations for its opposition to imposing sanctions on Israel for annexing the Syrian Golan Heights.

Announcement of intentions to set up the committee, whose role is far from clear, came from Defense Secretary Caspar Weinberger at the end of his visit to Saudi Arabia on Feb. 9.

The apparent softening of gulf state attitudes toward military cooperation with the United States has not gone unnoticed by anti-American elements in the Arab world. Earlier this month, a top-ranking Palestine Liberation Organization leader, Salah Khalaf Abu Iyad, denounced the Saudi-American accord as a cover for establishing a foreign base in an Arab country and expressed concern that other gulf states would soon follow suit.

"This move may benefit the Americans but it most certainly will not serve Saudi interests," he said in the Beirut-based weekly Monday Morning. "This will prompt countries like democratic South Yemen to strengthen their alliance with the Soviet Union and turn the gulf region into a region of tension."

But Khalaf's remarks were polite compared to those of Tehran radio. Calling Saudi leaders "stooges" of the United States and "dwarf rulers," the radio said they had "laid their territories, sea and airports open to the U.S. forces and have made an arsenal for U.S. arms and military equipment in the Arabian Peninsula in order for the United States to use them in its attack against our Moslem peoples."

The radio warned that "the Islam that overthrew the thrones of tyrant predecessors is capable of overthrowing thrones and palaces today."

There seems to be a growing realization in the Arab gulf states that the kind of joint air defense system required to protect them from Iranian warplanes--such as the one that bombed a Kuwaiti oil and gas separating plant in October, causing $100 million in damage--will require an American connection.

With the sale of five Airborne Warning and Control System aircraft to Saudi Arabia and of improved Hawk missiles to both the Saudis and Kuwaitis, the elements for such a system seem to be taking shape. The United Arab Emirates is also considering the purchase of $500 million worth of American arms, including Hawk missiles.

The problem now for the Arab Gulf rulers and the United States is how to present this expanding military relationship to the outside world and keep it from undermining the very regimes it is meant to protect.

The non-American Western diplomat in Abu Dhabi summed up the attitude of the Arab Gulf rulers toward U.S. military aid this way: "They want you as a friend in the closet or behind the curtain."