China is courting both sides in the Iran-Iraq war as part of a larger strategy to compete for economic and political influence in the oil-rich Persian Gulf, according to diplomats here.

The diplomats say this policy--which involves Peking in aggressive trading and possibly military sales to both combatants--is aimed at challenging Soviet strategic stature in the region, strengthening China's claim to Third World leadership and positioning China for a lucrative share of the inevitable postwar reconstruction business.

One immediate benefit is China's fast-growing economic presence in the area. Last week, China and Iran agreed to a 150 percent increase in trade this year, with two-way exchanges to reach $500 million. The agreement unexpectedly propelled Tehran into first place among Peking's Middle East trading partners.

Meanwhile, Peking draws badly needed foreign exchange from Iraq by exporting Chinese work gangs. The 20,000 Chinese contract laborers now building Iraqi factories and repairing oil pipelines net most of the estimated $2 billion that China earns annually from this human export to gulf states.

And, despite Chinese denials, there is strong belief among knowledgeable foreign analysts here that Peking is spicing up its gulf dealings with military supplies to the warring parties.

Ever since the Persian Gulf war broke out in September 1980, China has declared "strict neutrality." Calling for a quick end to the war of attrition, it argues that the conflict is economically debilitating and only invites exploitation by "hegemonistic" superpowers.

"China has never supplied any weapons to either party of the Iran-Iraq war, nor has China transferred any weapons to Iran or Iraq on behalf of any country," a spokesman for the Chinese Foreign Ministry said last week.

But, diplomats here point out, behind the wall of Chinese denials emerges a different picture gleaned from western intelligence reports and unusual commercial transactions between Peking and the two gulf rivals.

Reports quoting U.S. intelligence officials said China is a major source of military supplies for Iraq, which Peking has been courting since it began drifting out of the Soviet sphere and moving closer to Arab moderates friendly with China.

Most of China's arms are based on Soviet models, making it easy for Iraq to integrate the Chinese hardware into its largely Soviet-supplied arsenal.

Diplomats in Peking, while they have no estimate of volume or precise inventory, believe China is supplying Iraq with light arms, field artillery, ammunition and replacement parts. The supplies are said to move through the Jordanian Red Sea port of Aqaba before reaching Iraq.

Moscow is still Iraq's main arms supplier, with France in second place, according to diplomatic and military sources in Baghdad. There have been recent, unconfirmed reports in British newspapers of new agreements sending additional Soviet missiles, planes, antitank guns and ammunition to Iraq.

One theory here is that Baghdad is paying for the Chinese arms with oil. Officially, Iraq exports only dates to China in the two nations' annual $120 million trade package. Suspicions of an oil deal were aroused, however, when Peking privately made offers to recent state visitors from Turkey to sell large quantities of Iraqi oil. The war has blocked all of Iraq's normal oil export routes except a pipeline through Turkey to the Mediterranean Sea, so China's offers suggested that it had obtained access to a share of Iraqi output and was trying to sell the petroleum to the Turks.

"If you put two and two together, you've got Chinese arms for Iraqi oil on the hush hush," said a western diplomat.

Diplomats believe Peking is balancing the ledger through covert dealings with Iran. According to western military sources, China allows North Korean aircraft laden with arms for Iran to stop for refueling at airports in western China.

Other military sources said Peking transports some of the supplies in its own aircraft.

When Iraqi officials asked the Chinese Foreign Ministry about these persistent reports, they were reminded of Peking's neutrality.

"I'm not convinced," said a senior Iraqi diplomat.

Once again, commercial transactions have given foreign analysts some insight. Their focus has been the new Sino-Iranian trade pact, which was surprisingly large considering Peking's cool relations with the Islamic revolutionary regime in Tehran.

The $300 million in increased trade was so large--it catapults Tehran ahead of China's oldest and friendliest trading partners in the entire Middle East--that diplomats have concluded that the package contains Chinese military supplies or civilian equipment that can be converted into military uses, such as jeeps and trucks.

"Anything they're selling to these countries Iran and Iraq today is military related," observed a well-informed Middle East diplomat.

Although China has had difficulty warming up to Tehran because of its past ties with the ousted shah, it is openly wary of Soviet inroads there.

What lies behind China's neutrality in the gulf war, diplomats hold, is the self-serving aim of preventing either rival from falling into the Soviet sphere by default. The same logic explains China's arming of insurgents fighting Soviet troops in neighboring Afghanistan.

Strategically speaking, Peking realizes that its access to the gulf's political capitals and markets depends on keeping the region free of Soviet domination. Of equal importance to Peking is keeping the gulf's oil flowing freely to Western Europe and Japan, from which China expects to get much of the technology and know-how for its own modernization, according to diplomats.

A postwar gulf open to a Chinese economic role could provide a rich vein of foreign exchange needed to pay for help from industrial nations, diplomats said. Peking has sized up the region as a perfect fit for cheap Chinese contract labor, prefabricated factories and consumer goods.

"China isn't actively supporting one of the parties in the war," said a Middle East envoy. "It's dealing with both sides to keep its options open for after the war.

"If China was secretly arming one side, the international law books would call it beneficial neutrality. If it is arming both sides while claiming neutrality, then it is called opportunism."