A somewhat rueful Rayburn D. Hanzlik conceded yesterday that his plans to shut down the Department of Energy's Economic Regulatory Administration have been thwarted, at least temporarily.

The office, with Hanzlik still at its head, will continue for at least three more months trying to reach settlements in several hundred remaining cases where the government believes defunct federal price-control regulations were violated. At the same time, the agency will try to figure out how to use its federally mandated 450 employes.

Hanzlik is not the first to find tough sledding in his attempts to close a government agency. Had the Reagan administration been successful in its original plans, the Energy Department wouldn't be here now either, nor would the Education Department, nor a number of smaller agencies marked for early extinction.

In Hanzlik's case, the forces of Congress and legal process combined to keep his agency alive.

"We put together a plan last October to complete the enforcement work by last month," Hanzlik said yesterday. By June, it was becoming clear that the agency would fall short of that goal, mainly because crude oil resellers were resisting subpoenas for records.

In the meantime, Congress passed a supplementary appropriations bill that required the agency to maintain a minimum staff of 450 full-time employes. The agency quickly rehired some of the 217 employes who had been riffed to pare it down to 400. Hanzlik had hoped to reduce that to 344 by last Friday, the beginning of the fiscal year.

"To put it mildly, I was outraged," said Hanzlik.

Critics have called Hanzlik a reluctant enforcer of the expired regulations, but he defended the agency's efforts to wrap up activities stemming from alleged violations during seven years of price controls on gasoline, oil and other petroleum products.

"We knew as more time went by, the more difficult it would be to enforce these," he said. The agency had told companies that they had until September to reach settlements with the government. If they failed, they would be hauled into court.

But Hanzlik said yesterday the companies could negotiate for another three months. He said he hopes Congress will rescind its decision to put a floor under employment at the agency, but he noted that no recission could take place until March.

Of 20 cases involving major oil companies, 10 have been settled and all except one or two of the others are near settlement, he said. The most difficult cases have involved crude oil resellers, a class of traders that sprang up when crude was in short supply, Hanzlik said.

Since last Oct. 1, the agency has settled, gone to court on or otherwise resolved approximately 600 of the 1,100 cases pending, he said, and another 380 cases are "just on the threshold of being settled." Hanzlik hopes the remaining 120 "hard-core" cases will be settled in the months ahead. The agency has referred 13 cases to the Justice Department for possible prosecution.

Hanzlik said the government has collected nearly $1.1 billion as a result of the settlements, but other estimates have put the potentially collectible amount much higher than that.

Meanwhile, about $500 million in funds collected by Hanzlik's agency, much of which cannot be returned to the victims of overpricing because they cannot be identified, has become a political problem for the Reagan administration.

The nation's governors, concerned that the money might end up in the federal treasury, have proposed that they receive the funds earmarked for energy programs. Hanzlik said he had recommended that a sizable chunk of the $500 million go to the states for that purpose.