The government's first effort to get unstuck from a mountain of surplus sugar is going to cost taxpayers $36 million, with the prospect of bigger losses from future bargain-basement sales.

About 122,000 tons of sugar acquired by the Agriculture Department's Commodity Credit Corp. in a $43.2 million crop loan default was sold last month for $7.4 million to Shepherd Oil Co. of Jennings, La., to be converted into ethanol for blending with gasoline.

At those fire-sale rates, the government could end up with losses of more than $100 million by unloading sugar surpluses that were produced by a federal farm program snafu.

Daniel G. Amstutz, undersecretary of Agriculture for international affairs and commodity programs, said that despite the expected losses, the government has little choice other than to try to sell the rest of the surplus sugar for ethanol.

"In our view it was just not saleable at U.S. prices without exacerbating the mandate of the new farm legislation," he said. "And we would view it as predatory to sell it on the world market and put another nail in the coffin of beleaguered Third World countries that rely on sugar sales."

The alternative: Sell the sugar for ethanol, save major storage costs and take the losses.

The sugar sold last month was part of a 290,000-ton lot forfeited to the government last fall by five Florida processors, who chose to give up the sugar rather than repay the crop loans of about 18 cents per pound that they received from the USDA.

The loans were made under the 1981 farm law, which stipulated that the sugar support program was to have been operated at no cost to the Treasury. To do that, however, a system of import quotas was ordered to protect domestic growers with a guaranteed price.

But the Floridians contended that the Reagan administration changed the rules last fall by bowing to a heavy lobbying effort by friendly Caribbean nations for an increase in the sugar import quotas. The increases were defended as a key to the success of Reagan's special aid program for the region.

The new quota announced by the administration allowed 1.7 million metric tons into the United States. To operate the sugar support program at no cost, as Congress ordered in 1981, the quota would have had to be lowered to about 1 million metric tons.

Amstutz conceded that the quota issue may have been a factor in the forfeitures. But he said that a larger-than-expected sugar beet crop and sharply curtailed use of sugar by soft drink bottlers also contributed to a domestic surplus.

In any case, Amstutz said, the government decided to take a loss on last month's sale rather than continue to pay sizable storage costs on the sugar (7.2 cents per hundred pounds each month) or dump it on the depressed world market and possibly undercut Caribbean Basin allies of the United States.

New farm legislation, signed last month by President Reagan, continued the sugar support program against the administration's wishes, but put a tighter leash on quota-setters to assure that the program would operate at no cost to the Treasury.

What does the $36 million loss on the sugar sale say?

"It says the program stinks," Amstutz said. He said the new farm bill also will restrict the government's ability to sell future surpluses "and we'll be forced to hold it -- and that could be forever."

While the government will take major losses on its surplus sugar sales, another side, the renewable energy lobby, is applauding from the wings as the sugar is converted to gasoline-extending ethanol.

"For every gallon of ethanol that enters the market, it means two gallons of crude oil that we don't have to import," said William Holmberg of the Center for Renewable Resources. "There is a very positive effect -- the money stays here and the blended fuel is better for the environment. There are additional benefits in the government's reduced storage costs."

By Holmberg's calculations, the 122,000 tons of sugar sold last month by the commodity credit unit could be refined into about 31 million gallons of ethanol. That in turn would displace about 62 million gallons of imported oil, which would cost about $37.8 million at today's $26 per-barrel price.

Shepherd Oil, which entered the high bid on the sugar, turned out to be a double winner by buying the raw product at less than 4 cents a pound and by turning it into a fuel that is protected by another federal subsidy.

Ethanol is made competitive with its exemption from the federal excise tax, a benefit that gives the industry a 60-cent subsidy for each gallon. According to Eric Vaughn of the Renewable Fuels Association, the tax break on ethanol costs the Treasury about $220 million annually.

But, Vaughn said, the overall gains from ethanol development outweigh the losses by reducing federal spending to prop up other farm commodities.

"We think what the USDA is doing makes a lot of sense, turning surplus sugar into ethanol," Vaughn said. "While there is a loss on the excise tax, the ethanol industry consumed 230 million bushels of grain last year and raised the value of corn by 10 cents a bushel. We argue that this actually saved the government about $650 million in lower federal farm program costs."