The Mexican government has denied promising that the shah of Iran could return to Mexico after receiving medical treatment in the United States, and a State Department cable says it was the "Rockfeller office" that provided information suggesting the shah could go back.

The cable, dated Oct. 21, the day before the shah left Mexico for New York City, has added to a widening controversy over the circumstances of the shah's trip here for cancer treatment -- a trip that resulted in a retaliatory seizure of American hostages in Tehran.

Last week, The Los Angeles Times reported that the shah had left Mexico believing he had assurances from President Jose Lopez Portillo that he could return. The story said that written assurances had been handed to the shah by an intermediary the day before he left Mexico.

However, the disclosure to The Los Angeles Times of the text of the Oct. 21 State Department cable makes clear that the "Rockfeller office," rather than the Mexican government, was the source of the information regarding the assurances to the shah.

The cable reads, in part:

"Rockfeller office has informed us that [Mexican President Jose] Lopez Portillo sent the following message to the former shah on Oct. 20, responding to a request made to him by the shah to permit the shah's return to Mexico following medical treatment in U.S. . . . ."

According to the cable, Lopez Portillo told the exiled ruler that the shah was "always welcome" and that "we await your return."

In The Los Angeles Times story revealing the communication, there was no indication that the State Department's source for the reported communication between Lopez Portillo and the shah was the "Rockfeller office." On Dec. 21, the Mexican Embassy in Washington denied in a letter to the newspaper that the quoted assurances of asylum were authentic.

The shah left the United States Dec. 15 for Contadora Island, Panama, after spending 13 days at Lackland Air Force Base in Texas. The shah was transferred from New York Hospital to the Texas base after more than five weeks of treatment for lymph gland cancer and gallstones.

According to a letter from Mexican Ambassador Hugo B. Margain to The Los Angeles Times, "The letter which President Lopez Portillo allegedly wrote never existed."

Further more, Margain said, "No assurance [of the shah's return] was given to the U.S. government, which at no time officially requested the Mexican government to readmit the ex-shah at the end of his treatment in New York."

The ambassador's letter cited as reasons for refusing to allow the shah's return the "vital interests" of Mexico and the fact that circumstances were "radically different" after the shah entered the United States.

A Mexican official here said yesterday that there may have been a verbal "exchange of amenities" between the shah and Lopez Portillo, but "never a letter as such."

Margain also termed as "preposterous" reports that Lopez Portillo, on visits to the shah, attempted to get the shah to invest in Mexican enterprises. The Los Angeles Times had quoted a Carter administration official as saying "we understand" Lopez Portillo made such attempts.

Margin said that Lopez Portillo was too "preoccupied with the needs of his people and country to transform himself into an investment adviser."

Efforts yesterday to reach officials in the office of New York banker David Rockefeller were unsuccessful. Rockefeller has acknowledged playing a major role in pressing for the admission of the shah to the United States, and it is presumed that the "rockefeller office" mentioned in the cable referred to him.

The State Department cable did not disclose who in the Rockefeller office had provided the information about the Mexican assurances whose existence now is denied by Mexican authorities.

State Department officials refused to comment on the Oct. 21 cable other than to confirm its existence and to corroborate the accuracy of the text reported by The Los Angeles Times.

The cable was signed by Undersecretary of State Warren Christopher. Other parts of the message appeared to raise questions about the weight the State Department gave to the Rockfeller office's information. Christopher's cable said only that the Mexican president had agreed "to the shah's request to keep open the possibility of his return to Mexico" -- rather than to any solid reasurrance that the shah would be admitted.

Former secretary of state Henry A. Kissinger has acknowledged that he pressed Carter administration officials on five occasions to consider admitting the shah, but none after July.

Kissinger has written that he, Rockefeller and New York laywer John J. McCloy all "tried to be helpful with private matters on a personal basis," including trying to find schooling for the shah's children.