There are those who remember when Gary N. Dietrich, during the Carter administration, would earnestly explain why the government should discourage dumping hazardous waste in landfills.

Yet when the new regime at the Environmental Protection Agency needed someone to explain why such dumping wasn't necessarily a bad idea, it turned to Dietrich.

In recent weeks, Dietrich--the director of EPA's Office of Solid Waste and a 22-year government veteran--has defended the Reagan administration's policies on hazardous waste disposal at congressional hearings, public meetings and press conferences. He is, in the words of a congressional staffer, "the consummate bureaucrat, a real survivor."

The 47-year-old Senior Executive Service member said in a recent interview that he has "not enjoyed" being in the hot seat, that he merely wants to be allowed to continue his work at EPA and retire in eight years, "if they don't change the retirement age." Most observers say that despite increasing departures from EPA and the reportedly politicized nature of life there, Dietrich will make it to retirement.

Dietrich has "impressive technical expertise" in solid waste issues, said a congressional critic, and that makes him invaluable to top EPA officials because he is willing to "fashion that expertise to reflect" the thinking of his bosses.

"I have a deep respect for his ability to last at EPA and not to get frustrated," said an industry lobbyist. "He must have a strong stomach."

"Gary has several things going for him," added a staffer who has been with the Office of Solid Waste for several years and has been critical of EPA chief Anne M. Gorsuch. "He's hard-working, accessible, extremely well-respected here, and knows those RCRA (Resource Conservation and Recovery Act) regs better than anyone."

EPA's enforcement of that law recently made headlines, when the agency lifted a ban on disposing hazardous wastes in landfills for 90 days. After an outcry from state and local governments and environmentalists, the ban was reimposed and the agency said it would move cautiously in revising the disposal regulations. Dietrich now admits that the agency handled the issue ineptly from a public relations standpoint.

Dietrich, an engineer by training, has spent most of his professional life in federal pollution control programs, first at the Department of Health, Education and Welfare and then the Interior Department, until EPA was created in 1970. He served on the task force that set up EPA and worked in EPA's budget office and water pollution control office before moving in 1978 to the Office of Solid Waste. During the Carter years, he helped write many of the solid-waste regulations.

He acknowledges freely that there is a difference between the way the Reagan and Carter administrations approach environmental questions, because, he said, the Reagan administration believes it has a "mandate from the electorate" to reexamine environmental restrictions.

For example, he said, "the last administration took it for granted" that operators of hazardous waste facilities should hold liability insurance covering damages caused by hazardous waste leaks. "The new administration," Dietrich said, "asked the question: is third-party liability indeed desirable and necessary?"

"So obviously as a bureaucrat here my advice was to go through proposed rule-making and have those issues examined during public comment period," Dietrich said, adding that the EPA has decided not to kill this requirement. An industry source said Dietrich supported the insurance requirement and worked quietly to convince EPA to keep the provisions, but environmentalists fear that the requirement still may be watered down.

One environmentalist accused Dietrich of "selling out" to the Reagan administration by publicly justifying changes in regulations he had helped design. But another environmentalist said she knows Dietrich is in "a tough spot" and thinks "his heart's in the right place." A congressional source said "it's tough" to try to be a "faceless professional bureaucrat" when there is such "an effort from the top to politicize the agency."

An EPA observer who worked with Dietrich on water issues said he thinks Dietrich, "like any other good employe," supplies facts and raises questions, but after a decision is made by his bosses he "pulls for the team."

Dietrich put it this way: "Ultimately the policy is set by the administrator, no matter what administration."