Officials of the nation's hospital industry say that for the first time in years they are close to agreeing with the federal government on holding down hospital costs.

They say that with a little luck, Americans may spend less than $80 billion this year on surgery, tests and room and board at infirmaries around the country. Last year, they spent $67.8 billion.

The federal government recently issued voluntary guidelines for increases in the growth of hospital expenditures. The guidelines suggest that the industry hold this year's rate to the same level as last year, 13.4 percent.

This would amount to a reduction in the rate of growth of about 1.7 percentage points -- a figure close to the industry's stated goal of 1.5 percentage points. Industry spokesmen called the federal figure "an important vote of support" for voluntary efforts to cut hospital costs.

"We're looking forward to being able to work with them now," said Michael Bromberg, executive director of the Federation of American Hospitals. "That's probably the first time in three years we've been able to say that."

Federal health officials estimate that holding the line on hospital costs could save consumers as much as $900 million this year, including $350 million in federal spending under Medicare and Medicaid.

Though industry officials are confident they will be able to keep hospital expenditures around $78 billion this year, there are signs that may be a more difficult figure to achieve than they had anticipated.

They fear their efforts could be seriously hampered if the recession does not bottom out within the next month or two.

"It's going to be tough, but we're working like hell to do it," said Paul Earle, executive director of The Voluntary Effort to Contain Health Care Costs. What we're seeing already is an increased demand for hospital services."

Unlike most industries, hospitals normally experience more business during recessions. Medical coverage for workers extends 60 to 90 days beyond the time employes receive their layoff notices and many choose to take advantage before their coverage runs out.

In the first quarter of 1980, Earle said, hospital admissions were up 3.6 percent over the same period last year. Many are for tests and elective surgery -- "things people have put off because they had a job.

"For the first four or five months of 1980, we've been falling a little bit short of the target," said Earle. "But we're projecting a slight decline [in admissions] in the last half of the year."

Hospital costs have been the subject of a bitter dispute between the industry and the Carter administration since 1977, when President Carter introduced legislation that would have required that growth be kept to no more than 9 percent a year.

Intended as a first step toward a national health insurance policy, the measure failed to pass Congress in the face of intense industry lobbying.