The nation's railroads, in an impressive display of lobbying muscle, won a multibillion-dollar victory yesterday as the House killed legislation that would have made it easier for competitors to build pipelines to carry coal from mines to market.

The 235-to-182 House vote was a bitter defeat for the coal and pipeline industries, which apparently believed that after twenty years of trying pipeline companies might be given authority to obtain federal rights-of-way across privately owned lands.

Proponents have contended that these pipelines, which carry a slurry mixture of finely ground coal and water, cannot readily be built without the right of eminent domain because railroads will not voluntarily let this powerful competitor cross their tracks.

The stakes in the vote were enormous. Two-thirds of the nation's coal moves to market by rail, providing railroads with more than one-third of their freight tonnage and $6 billion in annual revenues.

"Without coal, we would be in big trouble," a railroad official conceded.

At the same time, coal interests argued that, without slurry pipelines, much of their industry is at the railroads' mercy. More than 80 percent of all coal mines are served by a single rail carrier, and the rates rails can charge are no longer federally controlled.

Carl E. Bagge, president of the National Coal Association, termed defeat of the slurry pipeline legislation a "serious loss for competition and consumers." He expressed regret that the House, which voted to deregulate railroads three years ago, has "now chosen to limit competition for the shipment" of coal.

But William H. Dempsey, president of the Association of American Railroads, called the vote "a sound victory for those interested in preserving a healthy national transportation system," and expressed hope that the House action "will settle the issue once and for all."

Chairman Morris K. Udall (D-Ariz.) of the House Interior Committee, which wrote the bill, said he felt that the time of coal slurry pipelines "will come but apparently not yet." Backers made it clear they felt that coal slurry legislation was dead at least for this Congress.

The legislation's death yesterday came with surprising swiftness, and was rendered more puzzling by the fact that the House only minutes before had overwhelmingly rejected an amendment which sponsors said would have crippled the bill.

That amendment, defeated on a roll-call vote of 257 to 162, would have prohibited a state from selling water to coal pipelines unless all states which could be affected by that water use agreed to the sale.

After the amendment's defeat, the House leadership moved to begin taking up the 90 other amendments.

But opponents, confident that they had the votes to kill the bill without further delay, did not offer these amendments and the House moved directly to the final vote.

"I don't know what happened," a coal industry representative said last night. "Right up until that moment, everybody thought it was going to be very close."

The final vote was only slightly closer than it was five years ago, the last time a coal slurry bill reached the House floor, when it was defeated 246 to 161.

"What really helped this time was that we had the farmers, the traditional enemy of railroads, with us on this legislation," a railroad representative said. "And I think the drought of '83 helped us a lot. It made a lot of people realize how precious water really is."