Just weeks before President Carter is to visit Mexico for energy, immigration and trade talks, his chief energy adviser yesterday indicated that the administration may reject a proposed natural gas deal widely regarded as the key to rapid development of Mexico's massive oil resources.

Energy Secretary James R. Schlesinger, in a major natural gas policy address in New York, said the United States should place the highest priority on developing domestic natural gas -- including expensive Alaskan gas -- and only afterward consider buying Mexican, Canadian, or liquefied natural gas from abroad.

"Alternate supplies of gas should neither endanger nor discourage base production from the lower 48 states," Schlesigner said, adding that "a high priority should be placed" on completing the $12 billion Alaskan natural gas pipeline.

Schlesinger feels that building the pipeline is important in reducing American dependency on imports and fears that in the long run Mexican gas could undercut the project.

However, senior administration officials at the State and Treasury departments and close to the White House were careful yesterday to say that Schlesinger's statement of Mexican gas did not reflect President Carter's position.

"There are other ideas about how to deal with Mexican gas floating around the White House," said one senior of ficial who asked not to be identified.

Whatever position Carter eventually takes, Schlesinger's highly visible remarks to a meeting of petroleum analysts are bound to complicate Carter's meeting with Mexican President Jose Lopez Portillo Feb. 14-16 in Mexico City.

The widely publicized gas deal, which was blocked by Schlesinger last year, has become a symbol to Lopez Portillo's government of its abily to deal independently with the United States.

In the U.S. view, the deal is significant because most of Mexico's gas ocurs in association with oil. Thus, increased production of one fuel leads to increased production of the other, and some experts argue the Mexicans may not step up oil production if they do not have a market for their gas.

Last month The Washington Post reported that a secret national security study, Presidential Review Memorandum 41, had concluded that one key step toward improving U.S.-Mexican relations would be to complete the gas deal.

Last year the Central Intelligence Agency, in a still secret study, concluded that Mexico could produce up to 10 million barrels of oil a day -- as much as Saudi Arabia, the world's lead exporter does today -- by the end of the next decade.

Two years ago Petroleous Mexicanos (Pemex), Mexico's state-run oil company, agreed to sell six American companies led by Tenneco Inc., gas that would amount to about 4 percent of U.S. consumption. The sale would be at a price-indexed to the cost of heating oil. At that time, the price would have amounted to about $2.60 per thousand cubic feet, and has since risen to about $2.90. Mexico has refused to back down on its price, saying it would rather burn off or not produce its gas.

Schlesinger called on Pemex to lower its price to the equivalent price of residual fuel oil, about $2.35 per thousand cubic feet.

Lopez Portillo and Pemex head Diaz Serrano have said that they will refuse to back down on gas prices, and instead will either burn off Mexico's gas or reserve it for domestic consumption.

John McMillian, president of Northwest Alaskan Pipeline, heads the six-company consortium trying to finance the completion of the Alaskan pipeline. McMillian has said that ultimately Mexican gas -- which would cost less than Alaskan gas when delivered at the border -- could undercut his project.

The energy secretary, in effect, argued that Mexican and Canadian gas should be looked to as a supplement to domestic production, saying: "We would welcome additional supplies -- to the extent that they are reasonably reliable, are priced sufficiently attractively to maintain a market in the United States, and do not force the shutting-in of domestic production."

Last year DOE and congressional studies concluded that by 1985 Mexican gas could undersell Alaskan gas by as much as $1 per thousand cubic feet. Yesterday, however, Schlesinger said that the Alaskan gas project -- despite the fact that when it first started, it would cost more to produce than Mexican gas -- would be more beneficial for the American economy.