No matter how dogged the agricultural researchers might be, they can't find the cure for outbreaks of foot-in-mouth disease that occasionally zap the Agriculture Department.

The malady last week seized Richard W. Goldberg, a deputy undersecretary for international affairs and commodity programs, who apparently thought he was secure in a good-old-boy farm atmosphere of the U.S. Feed Grains Council.

Goldberg, addressing the council on export matters, lamented a recent ruling by U.S. District Court Judge June L. Green. The judge held that the USDA acted improperly last year by exempting a $536 million wheat sales agreement from cargo-preference requirements that would have sent at least half the grain on more expensive U.S. merchant vessels. The ruling sent exporters into a tizzy.

But Goldberg stunned the gathering by saying a male judge would have understood the issue better and would have ruled against the cargo-preference provision, opening the way for less expensive exports. "This is an illustration of why women shouldn't be allowed to go to law school, let alone be appointed to the bench," Goldberg said, according to a Commodity News Service reporter who attended the gathering. The remarks did not make the news wire services, but word spread quickly and Washington women involved in agriculture issues were furious.

"I was quite distressed," said Susan McCullough, the council's public affairs director, who was the only woman at the meeting. "But I was gratified that my male colleagues afterward privately expressed to me their displeasure with Mr. Goldberg's comments."

Goldberg conceded yesterday that he had made a remark "something like that," but said "it was a poor joke that reflected my frustration over the decision and its impact on our export efforts." The former North Dakota farmer and state senator added, "It was clearly a dumb thing to say . . .a bad joke and it isn't even funny. I am sorry -- it was just my frustration with things." WHO'S NERVOUS? . . .

High muckamucks at the USDA know that farmers are angry over the spring credit crunch and President Reagan's veto of a bill broadening the administration's debt-restructuring program. They also know that most farm groups are unhappy with White House proposals to slash federal crop supports.

But lock farmers out of the department?

When American Agriculture Movement members -- the same ones who brought the tractorcade here in 1979 -- came to town last week to lobby for their own farm bill proposals, they found the doors to the department shut. Inspector General John V. Graziano invoked "emergency" security measures that made it sound as though a horde of bomb throwers was expected. His precautions included locking doors and setting alarms, maintaining strict vigilance to make sure that no one entered without proper identification, and clearing the lot where top-level appointees usually park their cars.

"I can't deny it is related to the AAM visit," said an aide to Secretary John R. Block, "but we had no problems with them. We accommodated them with meetings whenever they asked. They were very well-behaved." AND TURN OFF THE LIGHTS! . . .

With all the talk and all the worry about the shaky economy in the small towns of rural America, one might expect the Office of Rural Development Policy to be working overtime to come up with bright new ideas. But in a budget-conscious administration, first things come first. Which may explain the memorandum that the office's chief, Willard (Bill) Phillips Jr., recently sent to his staff tightening rules for use of the photocopying machines for the rest of the year as a way to save money.

Commented one disgruntled bureaucrat: "Even assuming I knew what I wanted to print nine months from now, let alone how many copies, it seems to me that a lot of high-priced talent is working on this project and missing the boat on what is really important." BUDDY-BUDDY . . .

The Farmers Home Administration (FmHA) seems less antsy over money than the rural development policy office. Two years ago, FmHA hired a defeated Republican congressman, Clint Roberts of South Dakota, to advise on exports, even though the agency exports nothing. Now, according to the Food & Fiber Letter, a former South Carolina agriculture commissioner, G. Bryan Patrick Jr., has been hired on a part-time basis to travel the South and "provide written reports about southern feelings about the farm bill." Said editor Jim Webster: "Heck, we know a lot of people who'd write those for free."