The bad news wasn't of Richard E. Lyng's making and the president wasn't going to like it, but someone had to tell him.

So the new secretary of agriculture braced himself and marched over to the Oval Office. He told Ronald Reagan, his old friend from California, that the cost of federal farm-support programs was going to hit a record $26 billion.

The president simply buried his head in his hands. A totem of that moment, recorded by a White House photographer, hangs in Lyng's office.

Since that time last year, program costs have continued at astronomical levels. But among the bad there is a smattering of good economic news in agriculture. And Lyng, now 17 months on the job, is among the first to concede that much of it is not of his making either.

The farm policies Lyng is enforcing were crafted by Congress and the administration in 1985, months before he was chosen by President Reagan to succeed John R. Block. The economic crisis that has pushed tens of thousands of farmers off the land during the Reagan years was running full steam by the time Lyng became secretary.

What a difference 17 months can make. Days after he took office, Lyng went on a political swing to Iowa and Nebraska. Protest signs denounced agricultural "Block-heads" and "Ding-a-Lyngs." In the heart of the crisis belt, he incensed farmers even more with upbeat talk about a great new opportunity in agriculture. It seemed a rocky start.

Today many still disagree with his philosophy and his ideas, but no one refers to the secretary as a "Ding-a-Lyng." Some of the administration's sternest critics defer to Lyng and his style. The screaming between Congress and the administration that characterized the Block era has abated.

A lot of that has to do with Lyng's style, a pragmatic political sense and his refusal to take either himself or Washington's legions of self-important know-it-alls too seriously. At 69, he knows where he's been, where he's going and what's worth worrying about.

He spins delightful yarns about his president's storied memory lapses and political gaffes. He unabashedly says he's "not afraid" to tell Reagan when he disagrees on policy matters. Lyng even talks of his chagrin over his president's botching important farm statistics in public statements.

Lyng deplores his department's big spending on farm subsidies, but defends them as essential to carrying farmers through the hard times. He goes to the mat with the president's Office of Management and Budget, fighting for a more expensive wheat-support program because he thinks it makes better policy sense.

The other thing is that being secretary was never a burning goal, although his years as then-Gov. Reagan's agriculture director in California and his tour as an assistant secretary in the Nixon administration made him a front-runner for the top job in 1981.

Lyng lost out to Block when Midwest Republicans insisted on one of their own, but as a consolation he got the deputy secretary's job. He left in 1985 to set up a consulting firm, then returned last year when Reagan called. He came back, Lyng said, mainly because of the honor of it: serving in the Cabinet "of a president we admire."

Oddly enough, a goodly amount of his time is devoted to being negative.

"He has such a nice way of telling you to go to hell that you want to hurry up and make the trip," said Michael L. Hall of the National Corn Growers Association, which, from time to time, has been dispatched to those same fiery reaches by the Reagan administration.

David Senter of the populist American Agriculture Movement agreed. "He's accessible, but after you meet with him you don't feel you've accomplished much. He doesn't want to change anything . . . . But one thing about him -- you know where he's at; he's consistent, not moving around the screen. You respect someone who stays the course."

Peter C. Myers, a former farmer who is Lyng's deputy, said, "Dick Lyng eases along, but he can be very aggressive when he wants to. It doesn't seem like anything bothers him. He's been a great teacher for me -- he can say 'No' nicer than anyone I know. That's his and my main job, you know, to say, 'No, we can't do that.' He says it and they go away happy."

Lyng revealed the secret. "People come here when all else fails. It is a strange thing. People won't really read the law. They still want you to do things you can't do. You do say 'No' a lot, but I try to talk people out of it. I try not to say 'No, that's a stupid idea.' "

Not that all is negative. Lyng has moved into his work with the elan of a man determined not to be known as a "caretaker" of agriculture in the final years of the administration. He seems bent on leaving an imprint on the country's agricultural policy and on the Agriculture Department.

For example, Lyng played a key role in development of the administration's dramatic proposal this summer that agricultural nations wipe out all farm subsidies over the next decade. The proposal has been controversial; it was rejected out of hand by some U.S. trading competitors and has caused political debate at home.

"I have to give Dick Lyng genuine credit for advancing that proposal. They {the administration} had political courage to stand up and say this is what we need to do. If we ever hope to get anywhere near that goal, this would be the only vehicle," said Hall of the corn growers. "When you hook up Dick Lyng and Clayton Yeutter, the trade representative . . . we've not seen a team like this."

Lyng regards the proposal to the General Agreement on Tariffs and Trade (GATT) as a keystone of his tenure. "It is a historic proposal," he said in an interview, "and at the very least it will generate dialogue and debate on farm-support programs that are crying for some kind of reform.

"Clayton and I get along well; we'd both been here before," Lyng explained. "He's been kind to me. Regards me as a nice old man."

But while the GATT proposal, implying an end to some of the subsidies that American farmers embrace in life-or-death terms, was laid out as a road map, Lyng was being more pragmatic and political in his recent home-front battle over the wheat program.

Lyng endeared himself to farmers and legislators by defeating the budget-cutters, who wanted to save about $200 million in income-support costs by forcing wheat farmers to remove more acreage from production. Lyng's approach was to continue at current production levels but to cut the price-support loan, thus driving prices down a bit more.

The extra expense, he argued, was worth the message that it sent to U.S. competitors: that the United States would continue to seek markets with lower-cost wheat until others slowed their subsidy programs. Lyng won't say how he won the fight, but clearly, he went over OMB's head to the presidential level.

"We've got to have exports," Lyng said. "If we lose them, we have to reduce our production excessively. We prefer to get those markets in an unsubsidized way, but if others continue with their subsidies, we will subsidize with vigor. And we're getting better at it."

According to Carl Schwensen, executive vice president of the National Association of Wheat Growers, "The secretary felt it was a matter of whether or not he was going to control the responsibility of his Cabinet position . . . . We're trying to engage our competitors. And if we unilaterally retire more of our production, we lose."

The wheat growers, often critical of other administration farm policies, give Lyng high marks. "We like his style of administration; he has good political skills; he listens well and he guides his agencies well. He has done a skillful job," Schwensen said.

Lyng regularly visits USDA agencies in Washington and, in keeping with a strong civil rights enforcement order issued last year, he repeats his insistence on enforcement in each of his meetings with top administrators. His keen memory and knowledge of programs, his reluctance to immerse himself in briefing papers, his long hours and stamina -- despite quadruple bypass surgery while he was deputy secretary -- impress aides.

"I've tried to do a management job here," he said. "I've tried to use the pyramid system we have. I try to give the administrators the feeling that they have interest and support in the secretary's office."

Close associates who fret that Lyng may be "too nice" to be secretary also worry that his reliance on the management pyramid and his trust in departmental professionals allow the renegades to run unchecked. One aide remarked that the only time Lyng had shown anger was after he recently learned that chaos had returned to the civil rights enforcement office. The trust had been breached.

If the farmer groups give grudging approval to his performance, Lyng doesn't fare so well on other fronts. His quick defense of federal meat inspection in the face of recent disclosures of unsanitary conditions in packing plants has drawn fire from consumer groups. Continued efforts to cut rural housing programs and a paltry rural development proposal have been attacked vigorously by other critics.

"He hasn't gone after the nutrition programs with a sledgehammer -- he always talks about his record on nutrition -- but he thinks he's doing as much as he can with this administration," said Ellen Haas, executive director of Public Voice for Food & Health Policy.

"He doesn't give the issue the time he needs to understand the depth of the problem. This administration has failed to meet the needs of poverty and hunger in the United States, but it's not all the doing of Dick Lyng. We still find him responsive. He has an openness that goes beyond the traditional Reagan administration attitude."

Robert Rapoza of the National Rural Housing Coalition, which lobbies to retain funding for Farmers Home Administration low-income housing programs, is equally critical.

"Lyng has defended the Reagan budget that would end all of these programs. What they haven't killed outright, they're allowing to die on the vine," Rapoza said. "For example, three-quarters of the way through fiscal 1987 they have spent only 40 percent of their housing money. Millions of people are in bad housing in this country. The facts speak for themselves. No other comment is necessary."

Lyng bobs and weaves easily with these punches because, as Peter Myers put it, "he recognizes that everyone runs against the secretary of agriculture." Lyng's style only infrequently permits public rejoinders.

So how would he like to be remembered? He hasn't given the idea much thought. "I don't have an ego problem; I don't worry about immortality. You know, there are portraits around here of secretaries of agriculture that nobody ever heard of," he said.

A hint of another feeling appears in two color photographs in the reception area outside his office. One shows Lyng eating a cafeteria lunch with a couple of elementary-school students. The other shows Lyng and a teen-age president of the Future Farmers of America meeting with Reagan.

"No special reason," he said. "They're just kind of fun pictures."