Shah Mohammad Reza Pahlavi, driven from Iran by a revolt against his rule, has postponed indefinitely a planned stay in the United States and may return instead to Egypt for more of his open-ended "vacation," it was reported yesterday.

Sources close to the monarch in Marrakesh, the Moroccan winter capital where he arrived Monday, told The Associated Press that the American visit was put off because the shah is disappointed at what he sees as support for his opponents from President Carter.

U.S. officials reported here over the weekend that American policy has shifted from total support of the structure left behind by the shah -- the government of Prime Minister Shahpour Bakhtiar and a Regency Council -- to hopes for a broad compromise that would include backers of Bakhtiar, the army, the secular opposition and Ayatollah Ruhollah Khomeni.

Khomeini, the Paris-based Shiite Moslem leader, has spearheaded the campaign to abolish Iran's monarchy. U.S. willingness to see him have a role in the country's future seemed likely to displease the shah.

Hossein Amir-Sadeghi, the shah's unofficial spokesman in Tehran, told Washington Post correspondent Jona-than C. Randal that the monarch plans to remain about two weeks in Morocco and then return to Egypt. where he was the guest of President Anwar Sadat for five days last week.

Sadat's spokesman in Cairo was quoted by the semiofficial Egyptian newspaper A1 Ahram as saying Sadat had invited the shah to spend "most" of his time away from Iran in Egypt. The monarch responded that he would like to spend as much time as possible in Egypt but on his return would pay his own expenses, A1 Ahram reported.

Two other possible reasons were cited by various sources for the shah's dcision to delay his departure from Morcco:

Khomeini's announced intention to return to Tehran on Friday, which to return to Tehran on Friday, which has raised fears of a showdown between his followers and the Bakhtiar government appointed by the shah.

The shah's desire to remain in a Moslem country. along with the possibility that he will make pilgrimages to Mecca, Saudi Arabia, and Kerbala, Iraq, a major shrine for the Shiite sect to which 90 percent of Iran's 35 million inhabitants nominally belong.

State Department spokesman Hodding Carter said yesterday that the United States has no firm word on the monarch's travel plans, but reiterated a standing American invitation for him to spend time in this country.

"If and when he comes, we will be adequately prepared to meet the security situation," he added.

Except for Empress Farah, who is accompanying the shah, members of the royal family came to the United States last week in preparation for the arrival of the shah himself. He had been expected to stay at the palatial home of publisher Walter Annenberg in Palm Springs, Calif.

Instead, Iranian Ambassador Ardeshir Zahedi will escort the children to Morocco next week to join their parents there, Iranian Embassy spokesman Ali Tabatabai said.

The sources in Marrekesh said no final decision has been made on where the royal family finally will settle for what is expected to evolve into a long-term exile. France, Britain and Saudi Arabia all are under consideration, they added. And a high U.S. official said that as far as he knew so is the United States.

Switzerland, where the shah maintains a luxurious villa for what used to be annual skiing holidays with his family, has been ruled out because the Swiss have declined to accept responsibility for security, they said.