WASHINGTON (AP) _ Joe Kellogg, owner of a small grain elevator in Dacona, Colo., was surprised about eight months after buying wheat from a local farmer when the Farmers Home Administration came to him for payment of $10,000 the farmer had borrowed from the government.

Because of a unique provision in the law covering farm goods, Kellogg - who already had paid the farmer for the grain - was forced to pay for it a second time because he didn't know it was collateral for an unpaid FmHA loan. Under the loan agreement, the farmer was to have gotten any proceeds from the crop sale only after the bank had gotten its money back.

''The lawyer told me it would be too expensive to fight it, and I'd just lose anyway,'' Kellogg said of the 1981 setback, which he said wiped out his profit for the year. Since then, he has been nervous about a recurrence.

The episode illustrates a problem the grain and livestock industry claims is growing in seriousness as financial hard times, and credit problems in particular, beset American agriculture.

To remedy this ''double jeopardy'' risk - the prospect that buyers of farm goods could be forced to pay for their purchases twice - the industry is seeking to rewrite the law governing commercial transactions.

The House already has approved, as part of the 1985 farm bill, remedial language that gives so-called ''clear title'' to buyers of agricultural products. The Senate is likely to consider doing likewise when it takes up its version of the bill next week. But the banking industry is bitterly opposed, saying the contemplated action would violate states' rights to regulate commerce and that its effect would be to further restrict farm credit.

Simply stated, the problem stems from a provision in the Uniform Commercial Code - the model law adopted in some form by most states to govern commerce. The provision makes agricultural commodities used as loan collateral, unlike other goods, subject to claims by creditors even after they are sold.

What that means is that in many cases, buyers of farm commodities or livestock can be surprised by a lender who comes to them seeking payment of a loan made to the farmer who produced the goods. Industry spokesmen charge that situation is unfair.

''We are serving, in effect, as unwilling policemen - or innocent victims - of loans we do not make,'' said Dale Seyler, a director of the National Grain and Feed Association. Seyler told a Senate Banking Committee hearing last week that bankers receive interest payments for taking the risk of making a loan, but then shove that risk off on unwitting buyers.

It is unclear how often the problem arises because there are no national figures. Anecdotal evidence suggests that although there are some large examples - a $754,000 claim recently was lodged against a Jamestown, N.D., elevator - the national total is small compared to the volume of farm commerce.

The provision applies only to farm goods because they often are perishable and difficult to identify after sale, and because of the high risk involved in agricultural loans.

JoAnn Smith, a Micapony, Fla., rancher and president of the National Cattlemen's Association, noted that ''I can take my truck to Williston, about 20 miles from Micapony, to get a load of gravel, pay for it and go home with clear title. However, I can take that same truck to town, buy a load of corn and pay for it, but not go home with clear title.''

The House-approved language would put farm goods back in the same category as other merchandise unless the buyer of the commodities is notified in writing prior to the sale that a lender holds a mortgage on the goods.

Under the new provisions, farmers would have to give their lenders a list of possible purchasers for their crops or livestock, and the lenders in turn would notify those buyers of the lender's security interest in the products.

The language has bankers screaming.

It is ''totally unreasonable in expecting a lender to be able to anticipate when and to whom a farmer may choose to sell his mortgaged product,'' Glen E. Lemon, chairman of the First Bank and Trust Co. of Booker, Texas, told the panel. ''It's a guessing game, pure and simple.''

Bankers contend that the risk for buyers of having to pay for the same goods twice has been exaggerated, and that the House language would essentially rule out use of crops and livestock as loan collateral.

''Because of the credit crisis confronting the American farmer, a great many farmers are having great difficulty in obtaining credit on any basis,'' said Marlin D. Jackson, banking commissioner for Arkansas. ''Anything that increases the risk will significantly reduce the farmer's ability to obtain adequate credit.''

Jackson warned that if the new language becomes law, he would be forced to advise banks to stop making loans that rely for security on proceeds from sale of livestock and crops. To make such loans would come under the category of ''unsafe and unsound banking practices,'' he told the committee.

He suggested that the effort to rewrite the law is coming from ''the grain barons and giant poultry and meat processing companies'' to shift their normal business risks to the banks.

Bankers have suggested that instead of changing the law, a better, more centralized system should be developed for notifying potential buyers of liens against farm commodities, much as the title search system that is used in selling real estate.