The House yesterday dealt President Carter a sore defeat, killing his plan to put standby federal cost controls on hospitals and adopting instead a voluntary plan Carter supporters called meaningless.

The key vote, a victory for the hospital lobby that also defeated a similar bill in the last Congress, was 234 to 166.

House leaders had warned Carter that he lacked the votes to prevail on the issue, but the president, who had called the hospital cost-containment bill essential to the fight against inflation, has insisted that it be brought up yesterday. His reasoning was that it would do as well now as later.

Before the vote, Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass.) pleaded with the House to save the Carter plan, saying, "There is no single more important issue we can take up."

But GOP spokesman Rep. Robert H. Michel (R-Ill.) said the Carter bill would impose a bureaucratic mish-mush of controls on hospitals to satisfy Carter's political need for an imposing legislative victory for next year, election year.

The substitute that defeated Carter's bill was offered by Rep. Richard A. Gephardt (D-mo.). He is cochairman of Missourians for Carter-Mondale.

Administration spokesmen said afterward that they would try to revive their plan in the Senate, perhaps as an amendment to a health insurance bill now in the Finance Committee. But Rep. Henry A. Waxman (D-Calif)., who sponsored the carter bill in the House, said he thinks it is dead for this Congress.

At the White House, press secretary Jody Powell said the president's reaction to the vote was "unprintable." Powell called the vote "a blow to the fight against inflation," and said failure to adopt the mandatory program would add "tens of billions" of dollars to future budget outlays fo medical programs.

The hospital industry beat the Carter bill partly with the argument that it had already brought down the hospital inflation rate on its own, from about 19 percent a few years ago to 13.3 percent this year, the same as the rate for the economy as a whole.

Opposing the bill, along with the American Hospital Association and Federation of American Hospitals, was the American Medical Association.

Under the Carter bill, if hospital costs nationwide had risen more than 11.6 percent this year, federal controls would have been imposed, based on increases in hospital wages, the cost of hospital goods and other factors. A hospital receiving revenues in excess of its limit would have been subject to a fine.

The administration calculated that the version of the bill sent to the floor by the House Interstate and Foreign Commerce Committee would have saved about $41 billion from 1980 to 1984. The Congressional Budget. Office estimated the savings lower, at $20 billion.

Gephardt's substitute simply provided for creation of a national commission on hospital costs to monitor price increases and study the issue of hospital inflation.

The voluntary effort initiated by hospitals two years ago, Gephardt told the House, has acieved substantial success.

However, Waxman said the voluntary program initiated by the hospitals had resulted directly from fear of Carter's mandatory proposal. He said that without the provision to trigger mandatory controls if voluntary effort fail the industry would relax and the whole upward spiral of hospital inflation would start again.

"Backup mandatory controls -- that is the guts of this legislation." Waxman said.

Charles B. Rangel (D-N.Y.), a Carter supporter, said the Gephardt amendment was a way "to do absolutely nothing."

On the key vote on the substitute, 135 Republicans and 99 Democrats voted for Gephardt, while eight Republicans and 158 Democrats voted against him.

In the Virginia delegation, Democrats Joseph L. Fisher and Herbert E. Harris II voted against the substitute and with the president. In the Maryland delegation all members voted against the substitute except Democrat Beverly B. Byron and Republicans Majorie S. Holt and Robert E. Bauman.