Representatives of U.S. farm cooperatives said yesterday that they are close to an agreement with Libya to sell wheat and corn in return for oil for their shortage-ridden diesel fuel refineries.

"I do feel it's going to be finalized," said Allan Grant, President of the American Farm Bureau Federation. Grant and other members of a trade delegation held talks in Tripoli from May 2 to 7, and are to return for more detailed negotiations in early July.

Grant stressed that the commodities would be tagged at prevailing prices but that savings on oil would be realized by eliminating middlemen. The six major refineries owned by farmer cooperatives have a capacity of half a million barrels a day, and Grant said purchases up to this amount were being considered.

Grain requirements are small in Libya, a North African country with 2.8 million people.

However, Grant said, requirements are expected to increase as Libya switches to more poultry and meat production.

In talks with the Farm Bureau officials. Libyan officials also indicated an interest in access to more U.S. grain for the purpose of supplying food aid to other Arab and Moslem countries that lack oil revenues.

Grant said that the State Department has expressed "no objection to a stright commercial deal," but State Department officials said yesterday that they have received only vague descriptions of the deal that is under study and therefore were not in position to approve or disapprove it.

A spokesman for the National Council of Farmer Cooperatives also disclosed yesterday that grain-for-oil deals had been discussed over the last two years with Algeria, China and Mexico, in addition to Libya, but that "these deals have had a habit of falling apart at the last minute."

Any agreement along the lines now being considered would have broad political and economic significance.

It would demonstrate that grain, as a major American resource, could be used to gain access to additional sources of foreign oil.

Most of Libya's production of 2 million barrels a day is committed under long-term contracts. Grant said Libyan officials gave the impression that any increment allocated to the farm organizations would come from new production.

Libya currently supplies the United States with 700,000 barrels a day, about 10 percent of U.S. imports. Members of the Organization of Petroleum Exporting Countries have been attempting to limit sales recently as a way of pushing prices up further.

Libyan prices have led the way, rising on the spot market from $14.52 a barrel at the beginning of the year to $21.09 on June 1, a 45 percent increase. (Wheat is selling for about $3.50 a bushel.)

However, industry and government sources yesterday questioned whether Libya would be able to bring new oil sources into production in less than a year.

The U.S. trade deficit with Libya last year was over $3 billion, so any new grain sales to offset this would probably be viewed positively here, U.S. officials said.

In a move that further strained relations between the two countries, the U.S. government recently refused to license the sale of commercial aircraft to Libya on grounds that they could have "military application."

No such restrictions exist on U.S. grain exports.

Farmer-owned oil refineries which produce crucial diesel fuel for farm machinery were hard hit by recent events becuase of their dependence on petroleum from Iran, whose flow of oil has been curtailed and interrupted since the revolution began there.

Rising oil prices have spurred action in Congress to match this with much higher prices for U.S. grain exported to other countries.

Rep. Jim Weaver (D-Ore.) and 52 cosponsors in the House have proposed that a national grain board under the Commodity Credit Corp. be set up to sell, barter or approve the export of grain at a price that would give farmers a higher return.

"We are the sleeping giant today," Weaver said Wednesday during a hearing he called before a House Agriculture subcommittee. "We are siting [with grain] where the Arab countries were 10 years ago."

Witnesses from the administration, private grain companies and several farm organizations testified against the bill. However, Weaver said his proposal had gained support from committee members. He noted that OPEC produces less than 10 percent of global energy requirements but nonetheless has been able to dictate oil prices. He said the United States, with 15 percent of world food production, could do the same.