In a reversal of its longstanding hostility toward Saudi Arabia, the Soviet Union suggested today that the time might be ripe for rapprochement between the Kremlin and the most influential American ally in the Arab world.

Several Western sources said that the suggestion -- contained in an influential Soviet publication and clearly approved at the highest government level -- may be the first public attempt by the Kremlin to exploit strains that have befallen the Saudi-U.S. relationship as a result of the Camp David accords and the Iranian crisis.

The Saudis and other conservative pro-Western Arab governments are reported to be deeply disturbed at the inability of Washington to keep Shah Mohammad Reza Pahlavi in power in Iran.

The article in the weekly Literary Gazette is being treated with intense interest by Western analysts trying to piece together Soviet intentions in the post-shah era in the Persian Gulf. The account, by a Soviet authority on Middle Eastern affairs, comes amid a virulent anti-American propaganda campaign by the Soviets during the Iranian crisis.

The writer, Igor Belyayev, declared: "The Soviet Union and Saudi Arabia have never fought each other and have never had any insoluble conflicts. Their social systems are different, but can that be a basis for mutual hostility?"

He described in positive terms the government of King Khalid and Crown Prince Fahd, asserting, "I think that the strongly exaggerated ideas of the anti-Sovietism of Saudi Arabia are deliberately created by Western European and American journalists."

The Saudis have strongly denied reports of discreet, high-level contacts between Riyadh and Moscow allegedly aimed at improving relations and possibly restoring diplomatic recognition, which lapsed soon after World War II.

The Saudis, with Iran one of the traditional "twin pillars" of American diplomacy that has blocked the Soviets from penetrating the Persian Gulf since World War II, were angered by President Carter's Camp David peace conference.

Belyayev wrote that Prince Fahd has not forgiven Carter's national security adviser, Zbigniew Brzezinski, for failing to tell the Saudis ahead of time about the summit, at which Carter mediated between Egyptian President Anwar Sadat and Israeli Prime Minister Menachem Begin.

He asserted that Saudi Arabia backed "a positive program" to achieve Middle East peace, and suggested Riyadh could be ready now to take a new foreign policy direction out of disillusionment with American attempts. He noted, however, that despite a possible falling out with Washington, the Saudis were avoiding taking a public position directly against the United States.

"Meanwhile, a situation has been created that demands urgent decisions," he asserted. "The U.S. and Israel, as well as Sadat, assume that the unification of the Arabs in the struggle for the solution of the most important problems will prove impossible.

"As we see it, a historic choice stands before Saudi Arabia: either defend the interests of the Arabs and together with them its own national interests, or risk too much by continuing to console itself with worn out illusions."

It has been seen here as significant that the Soviets have not publicly commented on the recent flight of advanced U.S. jet fighters into Saudi Arabia as a show of support for the Riyadh government in the face of the turmoil in Iran and the Soviet-inspired anti-American propaganda there.

One of the last significant Soviet Press comments on Saudi policies was in Izvestia, the government daily, last April. That piece called the Saudis "Israel's fellow-traveler... in carrying out U.S. aims," and said Riyadh under King Khalid aimed to turn the Persian Gulf into "a closed Arab lake."

Today's article, however, recalled that the late King Faisal, as crown prince, had visited Moscow officially in 1932 and Belyayev quoted him as saying then that the two nations were tied together "by the strongest links of friendship."

Some Third World diplomatic sources here consider it only a matter of time before Riyadh and Moscow move toward improved relations, regardless of what Saudi official announcements may assert.

With the shah gone and his country no longer the "policeman" of the Persian Gulf bolstering American influence, expanded Soviet influence there is part of the new reality.

Several of these sources are certain the Saudis recognize that and will act in their own interests.