The Shah of Iran is pressing ahead with a massive naval expansion program worth more than $5 billion that will double the size of his fleet, consolidate his control of the Presian Gulf and extend the Iranian naval presence into the Indian Ocean, according to military officials here.

Iran is close to agreement with West Germany on the purchase of six submarines and is negotiating with European suppliers for a dozen frigates at least eight minesweepers and possibly some patrol boats in a package worth about $3.5 billion, sources said.

Iran has already bought 12 French missilecarrying patrol boats, the first two of which were delivered recently. The imperial Iranian Navy has also ordered three used American Tangclass submarines, now being refurbished for delivery starting next year, and four modern Spruance-class destroyers due for delivery in the early 1980s. The combined cost of these fighting ships is estimated to exceed $1.5 billion.

The builup of the 22,000-man Navy, already by far the largest in the Persian Gulf region, will "consolidate a massive superiority"over the navies of Iran's Arab neighbors, a diplomat said. These other gulf littoral states are reportedly concerned about the expansion.

The Iranian Navy is estimated to have at least three times more manpower than the combined navies of the other littoral states - Iraq, Saudi Arabia, Kuwait, the United Arab Emirates, Qatar, Bahrain and Oman - whose forces consist mostly of patrol boats.

Besides the projected new vessels, Iran later is expected to order up to 10 additional West German submarines and has expressed interest in more minesweepers, sources said.

"In all cases, the Shah feels Iran is responsible for the region," a Western military attache said. "He is trying to part of a very old aim to fill the vacuum left by the British when they pulled out of the Persian Gulf.

In an interview recently, the Shah said his navy needed more ships "to go deep into the Indian Ocean." He expressed pessimism, sometimes mixed with seeming bitterness, about what he views as Washington's indeciveness in combating communist influence around the globe. He previously had made it clear that he is determined to assure the safety of oil tanker routes from the Persian Gulf alone if necessary.

Part of the shah's concern about what he sees as weak-willed U.S. policy has to do with Soviet and Cuban involvement in the Horn of Africa. Africa in open seas, "the question is not just a threat to the Red Sea and then the influence this could have over the whole of the Indian Ocean."

In this vein, a 1976 U.S. senate report said, "Iran is buying warships theoretically capable of important sea control missions along the vital oil sea lines of communication from the Persian Gulf to Japan and Europe."

THe study also noted that "in strategic terms the development of naval force capable of sustained operations in the Indian Ocean could have an impact upon the overall balance of maritime power in the area."

In the interview, the Shah was touchy and defensive about Iran's arms purchases in general.

"We have probably seven times said in reply to question about his request for additional U.S. fighter planes. "Just tell me how many planes West Germany and NATO have and compare it to our airspace. Why is it that you white people you European superior race - although you are not racists, you Americans, maybe you are - you can afford to have that number of kilometers or miles? Why should we have less than you?"

The Shah said all he wanted was enough weapons to be able to defend Iran against an invading conventional force.

"What is enough for us is precisely what is enough for you," he said. "I must admit you will always have more, I don't mind."

So far the air force and army have received most of the attention in Iran's huge military spending while the navy has remained a sort of poor cousin.

As part of a plan to rectify that, an Iranian delegation is currently in West Germany trying to sort out final details of the submarine purchase, military sources here confirmed. The main outstanding issue is a training program for Iranian crewmen, they said.

The West German diesel-engine submarines are one-third smaller but more manueuverable than the 4,200 ton Tang-class subs on order form the United States. "A German specialty," according to one military man, the model is ideally suited for "small, shallow seas" such as the Baltic and the North Sea - and the Persian Gulf. The submarine is also capable is also capable of venturing into the Arbaian Sea, but probably not very far into the distant waters of the Indian Ocean.

The new submarine, equipped with a special cooling system to handle the tepid waters of the gulf, are due for delivery in the early 1980s, sources said. They can eventually be based at Iran's ports of Bandar Abbas and Chah Bahar.

Negotiations to sell the vessels to Iran began after a socret decisions by West Germany's National Security Council in May 1977 to approve the transaction. Bonn has a policy of not selling arms to countries in a "region of tension," but Iran is not considered to be in that category.

The shah's naval buldup is setting off a scramble for orders among European shipyards, according to military analysts. Holland and West Germany are competing to sell Iran the dozen frigates and Belgium and France reportedly are also in the fray to supply minesweepers.

Last October, Holland's Prince Bernhard quietly visited Tehran to lend his weight to the Dutch case, diplomats here said.

The shah appears to want to diversify his naval orders and leaser his arms dependence on the United States, according to military sources. A main reason for this is the uncertainty the shah feels about future orders for his modern air force, which is exclusively U.S. supplied.