President Carter conducted a two-hour political sortie into the farm belt yesterday, attacking "special economic interest lobbies" that he said are undermining his anti-inflation efforts.

Carter's targets included Congress, federal workers and medical lobbies, but pointedly omitted the pressures of wheat, beef and sugar producers for higher support prices and tight agricultural quotas.

The president, who spent twice as much time flying here and back to Washington than he did with his farm audience, received a generally friendly reception from 4,000 people at a meeting of the Midcontinent Farmer's Association.

In the brief appearance, Carter struck hard at the theme of inflation, which could prove a serious liability to the White House in this fall's congressional elections.

White House officials characterized the speech as one of the president's strongest challenges to Congress. In it, he suggested that without strong, countervailing public pressure, Congress will inevitably cave into the desires of "special interest" groups.

He cited specifically the failure thus far to enact the administration's Civil Service revision and hospital cost-containment legislation, which he said has been frustrated by powerful lobbies on Capitol Hill.

"The fight against inflation becomes nearly impossible when the pressures of special economic interest lobbies are successful," he said. "These lobbies care absolutely nothing about the national interest - as long as they get theirs. We will never win the fight against inflation unless we help the Congress resist those pressures."

Pleading for support of the Civil Service overhaul legislation, Carter told the assembled farmers, "The Congress hears from the special interest lobbies. They need to hear from you."

But even as he was delivering this anti-inflation message, the president offered something to the farmers, who are seeking their own objectives from the government. Earlier this year, specifically as an anti-inflation measure, the administration eased beef import quotas in an effort to hold down meat prices.

The action brought strong protests from cattle producers. Yesterday, Carter promised there would be no repetition of the beef import quota decision in the immediate future.

"I will not permit any more expansion in beef imports this year. I will not permit unrestricted beef imports next year and I am strongly and permanently opposed to any price controls on meat," he said.

The president's one-day trip here, to spend little more than an hour with members of a regional farm organization, was itself a sign of his political problems and the White House's increasingly aggressive attempts to deal with them. For much of his administration, it has been unusual for Carter to leave Washington simply to address a particular group. But under the orchestration of White House media adviser Gerald Rafshoon, more such presidential forays to woo specific constituent groups are expected in the coming months.

Large segments of the farm population have been unhappy for months with administration policies. But while acknowledging the anger farmers have directed at him, Carter strongly defended his policies, saying the programs he has initiated "are beginning to take hold."

In the home state of Harry Truman, Carter also compared himself with the late president, saying he wanted to "give you some straight talk as Harry Truman would have about why we have inflation and what the American people, the administration and most of all the U.S. Congress must do to fight it."

The President promised to do what he could to curb inflation by limiting federal employes' pay raises to 5.5 percent this year and by reducing the federal budget deficit to less than $40 billion by fiscal 1980 - a long way from his campaign promise to balance the federal budget by fiscal 1981.

He also once again sought support for his energy legislation, saying that the record of the 95th Congress will be measured by its actions on energy.