For months, the tiny numbers atop the gas pump have been spinning like a haywire slot machine, while the gallon meter ground ahead at the pace of energy legislation moving through Congress.

But Glenn M. Heller, described by one local columnist as "this city's most nationally notorious personage since the Boston strangler," isn't jacking up his gas prices anymore.

A federal court judge here today, dampened Heller's attempt to pump his way into a higher tax bracket by charging what were thought to be the highest gas prices in the nation.

Heller was ordered to roll back his prices to a base of 83.9 cents a gallon for regular and 87.9 cents for unleaded, cutting his figures almost in half.

By midafternoon, Heller had complied with District Court Judge A David Mazzone's 10-day rollback order. Federal attorneys said they would seek a permanent injunction against Heller when the temporary order expires.

Between 50 and 100 spectators, some of them jeering, surrounded Heller today at his Beacon Hill Gulf station, which has become almost as hot an attraction here as Faneuil Hall. In recent days, passersby gawked incredulously as the latest prices were posted. Motorists did double takes and muttered obscenities.

"Hey, this clown is really nice, huh?" one driver yelled earlier this week as the latest numbers went up over Heller's pumps. "Incredible, what a ripoff!"

Monday Heller was charging $1.449 a gallon for regular and $1.489 for unleaded. Tuesday it was up another 8 cent a gallon.

And while he played on his entrepreneurial infamy, Glenn Heller also hit the judicial jackpot: Gulf Oil and the city of Boston are suing him, and the U.S. Energy Department wants to put him in jail and make him refund some of the money.

Shortly after Heller raised his prices Tuesday afternoon, U.S. marshals hauled him off to court in what is believed to be the first criminal gasoline price-gouging case. Heller pleaded innocent and was released on $10,000 bail. A probable-casue hearing is set for June 29.

Heller, 30, faces a $10,000 fine and a year in jail for allegedly charging 55 cents a gallon over the ceiling permitted by federal law.

The top selling price is determined by a complicated formula described in DOE's pricing and allocation regulations passed by Congress under the 1973 Mandatory Petroleum Act.

Basically, retailers take their prices from May 15, 1973, when the law went into effect, and then tack on increased gas costs, 3 cents a gallon for other operating costs and rent and tax increases.

The government's criminal complaint against Heller is based on his June 7 prices: $$1,389 for regular and $1.429 for unleaded. DOE said comparable area prices that day were 82.9 cents and 86.9 cents, respectively.

Gulf Oil Co., which filed suit against Heller to raise his rent from $700 to $1,200 a month, called his prices "deplorable," Carl Olson, president of the 1,800-member Bay State Gas Retailers Association, said, "He is basically screwing the consumer and giving us a bad name."

And Edward F. Harrington, U.S. attorney for Boston, said Heller was "price-gouging for personal profit at the expense of the public during a national energy crisis."

But Heller claimed he was just charging what the market would bear.

Robert Stobaugh, a professor at the Harvard Business School, says Heller's economic analysis is correct. "The fact that people are willing to pay $1.50 is indicative that they'll pay $2," he said.

Stobaugh, director of the Harvard energy Project, recently completed a study indicating that people will keep buying gas no matter how much it costs.

Even when Heller's prices were at their steepest, gas guzzlers continued to lumber up to his pumps, even during daytime hours, when, unbeknown to some motorists, the same type of gas was selling just down the block for about 60 cents a gallon less.

On motorist, Rob Taub, a teacher from New York, has a photograph taken of the price gauge as his tank was filled earlier this week. "I just wanted to tell the folks back home that I bought the most expensive gas in the nation," he said.

But most of Heller's customers are like Betty Kimbrough, a Harvard Employe, who pulled up to the station's pumps because her gas gauge was on empty.

"It's damn shame," she said after her turn at the pump, "It didn't even move the needle past "E." Her $2 has purchased 1.4 gallons.

Heller's station is open 24 hours a day, so much of the time it is the only show around.

Heller also charges $1.45 fro maps and 50 cents to use the air hoses - 25 cents for bicycles.

Last November, DOE's Enforcement Division moved to put an end to what some called "Heller's revenge."

Six months of bureaucratic wrangling ensued, with a civil case now pending in DOE's Office of Hearings and Appeals. The government alleges that Heller overcharged his customers $77,406 from Aug. 18, 1976, through Dec. 6, 1978.

Frustrated by the arduous federal process, Boston's energy office earlier this month filed suit against Heller in federal court here, requesting fines of $2,500 for each sale over the maximum legal price and $10,000 for each "willful" illegal sale.

U.S. Attorney Harrington followed with this week's federal suit, saying, "This arrest should put anyone else who's doing this kind of thing on notice that they're also susceptible to federal prosecution."

A grand jury is considering further action.

Through it all, Heller, who posed as one of his employes this week and then refused comment to a reporter, appears unfazed by the fact that his legal fees are rising even faster than his gas prices did.

His lawyer, Steven Brody, contends that Heller is not bound by the 1973 federal regulations because he purchased the station in 1975.

But Arthur Shaw, deputy district manager for the New England enforcement arm of DOE, contends that the regulations specifically state that retailers opening new gas stations are bound by the prices of the nearest comparable station. And if the retailer takes over an ongoing business, he inherits that station's price ceiling, Shaw says.

"I just don't get his argument," said Shaw. "It makes no sense."

Mazzone said today that he thought arguments by Heller's lawyer were "interesting and rather ingenious and even creative."

But the judge added that he disagreed. CAPTION: Picture, Glenn M. Heller removes his old posted price of $1.569 after judge's order. UPI