After weeks of nationalist displays in the Mexican press, a noisy anti-American demonstration and frequent verbal sparring by officials on both sides, the atmosphere for President Carter's arrival here today is less than warm.

White House officials have asked for -- and been given -- assurances that there will be no significant anti-Carter demonstrations during the 48-hour stay. But U.S. diplomats concede that they have informed Washingon of the "negative ambience' here.

On the face of it, Mexico can be expected to give Carter a friendly and festive welcome, as it does for all foreign visitors. But in reality, the country's mood is more nationalist and anti-American than it has been in years.

Part of the reason is the conflict over natural gas. Mexico nearly concluded a sale to the United States, but it was vetoed at the last moment in Washington over the price. In a broader sense, Mexicans are uneasy and defensive about the attention they have been getting from the United States as a result of its spectacular oil discoveries.

Both the press and government officials here have been mocking the "rediscovery of Mexico" by American politicians and media -- whose discussion of Mexican oil and gas in terms of "U.S. strategic reserves," combined with the Carter visit, has angered some Mexicans.

U.S. officials said, however, that they believed many of the "misperceptions" on both sides could be cleared up by the two presidents. Carter and President Jose Lopez Portillo are to hold seven hours of private talks.

The Carter visit is to be low profile. American officials attribute this to Carter's style of carrying out state visits. Their Mexican counterparts say it would not be polite to have a great deal of fanfare.

After arrival at Mexico City airport, Carter is to go to the National Palace for brief talks with Lopez Portillo. Before a Foreign Ministry lunch he is expected to see the famous Diego Rivera palace murals and visit Coyolxauhqui, the Aztec moon goddess discovered under the main square last year.

On Thursday, Carter is to helicopter to a small village some 90 miles southeast of here, called Ixtlilco el Grande, where the Mexicans are keen to show him a successful agricultural development project. But most of the program is designed around the two presidents' private time.

Officials on both sides have been emphasizing that the visit will be "very worthwhile" and stimulate the "continuing dialogue," diplomatic jargon for saying they expect no impresthe agreements.

There is no formal agenda for the presidents, who will be discussing the perennial bilateral problems of illegal Mexican migration to the United States, trade, narcotics and the new topic of Mexican gas and oil sales.

In recent days, tensions between the White House advance team and their Mexican counterparts have been high, according to a key Mexican official. The official said this was partly the result of the "we-run-this-show" attitude displayed by U.S. logistics and security men, and partly the Mexicans paying back the way they were treated during Lopez Portillo's trip to Washington two years ago.

At that time, the Mexican president's military chief of staff and aides were not permitted to check out movement and seating in the White House. In return, the U.S. security men were banned from 'Los Pinos,' the Mexican official residence until today.

Much of the irritation, however, surrounds Energy Secretary James Schlesinger, a man the Mexicans regard as going out of his way to be "derisive and insulting" to them. He canceled the gas deal, saying Mexico's price was too high.

Even Foreign Minister Santiago Roel -- openly pro-American and proud of being on first-name terms with Sectetary of State Cyrus Vance -- told a reporter that in Washington, "nobody seems to know what they want." When asked about Schlesinger's behavior, Roel burst out, "Schlesinger is a liar and you can quote me on that."

The Mexican press and local intelligentsia continue to warn Lopez Portillo against believing any American phrases like "special relationship" and "a new era" in dealing with Mexico.

An informal poll held by a local television station indicated ordinary Mexicans did not object to the visit, but all took for granted that Carter was coming for the sole purpose of getting Mexican oil.