In a sugar-coated lecture to local government officials yesterday, President Reagan said he would preserve one of their most cherished programs in new form. But at the same time he warned them that he would battle against "selfish interest groups" who want to gut his economic package.

"The real threat to recovery comes from those who will oppose only a small part of the overall program," Reagan said in a speech to the National League of Cities "Needless to say, the small portion these porochial groups oppose always deals with cuts that affect them directly."

Reagan did not name the "selfish" or "parochial" groups. But his raising of the issue was a veiled reminder that he intends to battle -- in nationwide televised appeals, if necessary -- for his more than $40 billion proposed budget cuts.

For the most part, the lunchtime audience of city officials jammed into a ballroom of the Washington Hilton seemed more attentive to than appreciative of the president's remarks.

But they applauded when he confirmed that he had decided to keep the Urban Development Action Grants (UDAG) program. It will be combined with existing community development grants into a new community development support program, providing block grants of the sort that local officials have long been seeking.

If the president's program is approved by Congress, this particular block grant will combine the carrot of greater local flexibilty with the stick of reduced spending. Proposed funding for the new program is $4.166 billion, a reduction of $460 million from the two separate programs in the fiscal 1982 budget proposed by President Carter.

Originally, UDAG was targeted for extinction by the Reagan budget cutters. But mayors and other city officials, who like the program because they can use federal funds to obtain private industry dollars and reward political supporters in the process, rallied successfully to its defense.

White House press secretary James Brady said afterward that the decision to retain UDAG showed that the president had genuinely consulted with local officials, rather than simply telling them what the administration intended to do. This same consultation, he said, produced a negative reaction to bilingual education, which Reagan attacked yesterday in his speech.

Reagan received his loudest applause when he charged that bilingual education "had been distorted at the federal level." Bilingual education serves a useful purpose when it is used to teach English to students who speak foreign languages at home, Reagan said.

"But it is absolutely wrong and against American concepts to have a bilingual education program that is now openly, admittedly dedicated to preserving their native language and never getting them adequate in English so they can go out into the job market and participate," the president declared in an extemporaneous addition to his text.

The Reagan administration has eliminated a federal regulation that would have required schools to teach non-English-speaking students in their native language.

Reagan also tried to placate his audience by assuring that there would be major economies in the Department of Defense, the one department where the president wants to increase the rate of overall spending.

"Cap Weinberger is anything but a big spender and was once given a nickname to confirm that fact," said Reagan of his secretary of defense. ". . . I can assure you that Cap is going to do a lot of trimming over there in Defense tgo make sure the American taxpayer is getting more bang for every buck that is spent. I've even heard that there was a sigh of relief in several other departments when it was learned that Cap was going to Defense."