THE RAILROADS BILL had seemed to be on the tracks when Congress recessed for the Republican convention. It had just survived what one of its sponsors called the "bellwether vote in the House," 281 to 130. But by last Thursday that 151-vote margin for deregulation had turned into a 13-vote margin against it. The House adopted an amendment so at odds with the bill's purpose that its sponsors withdrew the bill from further consideration.

What happened? Since July 4, several industrial and consumer organizations, in particular the utility companies, have been working hard to stop deregulation of railroad freight rates. They believe these rates will go up much more sharply if the railroads get some freedom in setting them than they will if the Interstate Commerce Commission continues its tight policng of the industry. Freedom thus means higher prices for some consumer goods and, perhaps, lower profits for some industries that are dependent on the railroads for transportation.

That view of the railroad bill has some validity, although the price increases it would encourage will probably be far less than the lobbying groups contend.

But it is an extremely narrow view that misses the point of deregulation and ignores the consequences of keeping too tight a federal leash on the railroads.

The simple fact is that the railroad industry, if it is to survive, has to have much more revenue than it has received in recent years. Too many railroads are in or near bankruptcy and too many more are failing to maintain their equipment and tracks. That additional revenue is going to have to come from increased freight, higher rates or higher government subsidies. Conrail, for example, says it will need $500 million more from the federal Treasury over the next five years if Congress continues to subsidize than it would need if it got more rate-setting freedom. The same pattern exists across the entire industry.

Deregulation has two basic goals. One is to give competition a freer hand in the marketplace; having already given much freedom to the airlines and the trucking companies. Congress would put the railroads at a competitive disadvantage by keeping the ICC's heavy hand on their rates. The other goal is to reduce the legal and administrative costs that any regulatory system imposes.

The choice before the House is this: It can keep freight rates down by refusing to give the railroads rate-setting freedom (as it voted to do last Thursday), thereby either killing the railroads or committing federal tax dollars to support them. Or it can reconsider its actions and pass a version of the administration's deregulation proposals that gives railroads the freedom they need to get the money they need in the marketplace -- rather than from the taxpayers' pockets.