U.S. Ambassador Patrick J. Lucey, after accompanying President Carter on a weekend visit to Wisconsin where Lucey used to be governor, announced on returning here yesterday that he will be staying at his post despite rumors of an imminent shift.

"The president felt that I should stay right here," Lucey said in an interview yesterday. he had been considered for a proposed new position in Washington as coordinator of U.S. policy toward Mexico.

According to some Carter administration officials, he was to be pulled back because he was not felt to have been effective enough in handling relations here. U.S.-Mexican ties have taken on new importance because of Mexico's oil discoveries.

Lucey said the president had been generous in his praise and while "I don't like to quote what the president said on a one-to-one basis, he repeated it publicly at a dinner," lucey said.

Although the embassy staff here had expected Carter to announce the shift of Lucey, the president said in Milwaukee that Lucey could stay "as long as he wants [because] I have utmost confidence in him."

The State Department, according to a well-placed U.S. source, has now begun looking for a candidate to fill the planned new ambassadorship to co-ordinate executive departments in Washington "to produce a much-needed coherent policy for Mexico."

Lucey, 61, has been a controversial ambassador. On the one hand, he alienated much of the American expatriate community here and upset some career diplomats by replacing the entire senior staff of the embassy soon after his arrival in July 1977.

On the other hand, Lucey is known for his warm relations with President Jose Lopez Portillo and Foreign Minister Santiago Roel. Even the usually critical Mexican press has never attacked the low-key Wisconsin Democrat.

Foreign Minister Roel, like Lucey a former politician without previous diplomatic experience, seemed keen to defend Lucey in a recent interview: "It's an injustice, these attacks on Lucey. He's been one of the best ambassadors the U.S. has ever had here. He's been very objective and unflappable without causing any problems here."

The American community appeared to have problems adjusting to changes in the social life as the Luceys cut back on dinners and receptions in the ambassador's residence and moved some events to the embassy premises. Jean Lucey, formerly a real estate broker, was criticized for showing less interest in women's and charity affairs than the wives of diplomats who preceded her.

The vast, largely Republican group of American businessmen here felt slighted as Lucey stopped consulting and entertaining them as frequently as in the past.

All the American community members interviewed told indignant Lucey stories but none was willing to be quoted by name.

While senior European diplomats say Lucey could be more acatenior European diplomats say Lucey could be more active on the diplomatic circuit, they point out that Mexican officials frequently tell them that they like Lucey's straight, calm and unceremonious way of doing business.

"Lucey has done what an American ambassador should do in a sensitive place like this: not meddle in our affairs,keep quiet and not provoke people," said a member of the Mexican Cabinet who often deals in bilateral econimic affairs.

Previous ambassadors John Joseph Jova and Robert Mcbride were widely respected among the Americans, but with higher profiles, they were frequent targets of the Mexican press.

Lucey's style has been less orthodox but Mexicans have made it clear that they approve, perhaps prefer a political appointee who has a direct line to the White House.

While it is felt that Carter decided to keep Lucey on the job in part because the published criticisms were judged to be unfair, some officials have indicated that he may not staylonger than through this year. CAPTION: Picture, PATRICK J. LUCEY . . . defended by his Mexican hosts