Sometime between 2 and 3 a.m. Friday, Norfolk Southern's negotiating team and the U.S. government reached agreement on a $1.2 billion deal for Conrail that, if Congress approves, will create the nation's largest railroad system.

Transportation Secretary Elizabeth Hanford Dole's choice of Norfolk Southern over other bidders closed a months-long, intrigue-filled first episode of the most heated and important transportation political battle since the Airline Deregulation Act of 1978.

If the deal goes through, the United States will be left with five major railroads -- two in the East and three in the West.

Railroads haul more than one-third of U.S. freight. They feed the utilities coal, carry grain to port and are fundamental to the economy.

The underlying central question -- one the United States has wrestled with since the Erie Canal -- will be how powerful any of those five railroads should be.

Conrail by itself has a limited, if stable, future, in the view of the most railroad analysts. A merger with another major road makes Conrail part of an enormous entity, with a virtual monopoly on service to New York, New Jersey and Pennsylvania.

Congressional approval of Dole's recommendation is by no means assured; it has strong opponents from labor, industry and politics.

Further, it will be easy for Congress to delay any decision because Conrail -- created in 1976 when the Northeast was threatened with the end of rail freight service after Penn Central collapsed -- no longer is a basket case. It has been making money since 1982 after swallowing about $7 billion in tax dollars, most of which it technically is obliged to repay but would be forgiven in the sale to Norfolk Southern.

The battle on Capitol Hill will feature:

* Two tenacious and proud personalities accustomed to getting their way and who resent interference -- Dole and Conrail Chairman L. Stanley Crane, who wants Conrail to remain under his control and who has the credentials to make such a proposition sound credible.

* Two enormous corporations -- Norfolk Southern and CSX, both Virginia-based railroad holding companies that compete fiercely.

* A collection of small regional railroads scattered from New England to the Mississippi that stand to gain from track-use rights they must be granted by Norfolk Southern-Conrail in order to assuage the Justice Department's concern about a lack of rail competition.

* Labor unions, shippers, and state and local politicians, each speaking for a special interest.

Dole chose Norfolk Southern over two other bidders -- Alleghany Corp., a New York holding company, and an investor group headed by hotel executive J.W. (Bill) Marriott Jr. She dismissed out of hand Crane's proposal that Conrail be sold to the public through a stock offering.

Dole and her principal advisers on Conrail -- Deputy Secretary James H. Burnley IV and Federal Railroad Administrator John H. Riley -- are known to have felt almost from the beginning that from a purely financial point of view, Norfolk Southern was the hands-down winner.

But Alleghany started the race 10 months ago with the opening bid. It had money from the sale of a major asset and long experience in railroading. Too long, in the view of Rep. James J. Florio (D-N.J.), chairman of a key congressional subcommittee in the Conrail battle, because Alleghany at one time held a majority interest in the New York Central, which merged with the Pennsylvania Railroad to become the Penn Central. Alleghany reduced its holdings and ultimately sold its Penn Central stock shortly before the bankruptcy.

Alleghany's bid was endorsed by the rail labor unions two weeks ago. Florio was furious. "For labor to endorse a proposal made by those who brought down the Penn Central is to turn their back on their members and rail service in the region," he said.

Dole dispatched Burnley last week to Miami, where the unions were meeting, to assess the labor situation. Labor reendorsed Alleghany, but Burnley learned that not all union leaders would oppose Norfolk Southern. "The best the department can hope for is benign neutrality," one source said.

Marriott was enticed into the bidding by Brian Freeman, labor's financial adviser in the Conrail transaction. Freeman said he had invited Marriott because "we needed someone who would bring strong management" despite the Marriott family's traditional opposition to unionized labor.

It was a strange entry. One day in December, while Marriott was standing in a hallway at the L'Enfant Plaza Hotel waiting to explain his offer to the Conrail board, he said, "I'm not even sure why we're doing this. When you consider everybody's role, the whole damn country's involved."

The unions unanimously opposed Marriott. Union leader Richard I. Kilroy said at a recent news conference, "I have a philosophical difference with Bill Marriott over trade union policy."

Dole regarded Crane's proposal for a public offering as an unwelcome intrusion from rogue management, and she expended considerable energy attempting to trim Crane's sails by lobbying his board members.

But Crane has a tremendous track record running railroads, first at the Southern Railway, which has become a part of Norfolk Southern, and now at Conrail. His views command respect. He never felt, according to Conrail insiders, that she appreciated his success at Conrail. She never felt he understood that he worked for the federal government.

Dole and Crane had one exceedingly unpleasant meeting in Washington where he refused to comment on the various offers as she had requested and conveyed the impression that he doubted she was in charge of the process.

"Liddy" Dole, according to those who work with her, is careful and demanding of detail, but there is no question among political appointees and career bureaucrats alike in the department that she is in charge.

Crane won the ear of the Pennsylvania delegation in Congress, which will oppose a Norfolk Southern purchase, and Crane probably will be impossible for Dole to remove or silence.

He has a catchy slogan, a bumper sticker in Conrail blue that says "Let Conrail Be Conrail," something a public offering would do.

Dole persuaded Norfolk Southern to initiate a study of a possible Conrail purchase. Norfolk Southern Chairman Robert B. Claytor could see the possibilities, but first had to persuade his board. Once he did that, Norfolk Southern pursued Conrail with a sophisticated lobbying effort.

In the last weeks, the contest came down to Norfolk Southern or Alleghany. Dole chose Norfolk Southern because, she said, "Looking at the financial package, Norfolk Southern offers us $1.2 billion. Period. . . . Also the Norfolk Southern is a very fine railroad corporation, with excellent management, the highest standards for maintenance in the industry, a very profitable company, and I know who I'm dealing with."

If there is one thing Dole has insisted on from the beginning of her slow decision process, it is that whoever gets Conrail should be strong enough to absorb bad times and assure that Conrail never returns to the federal property list.

While Norfolk Southern lobbyists have been busy selling a Conrail merger, CSX has been trying to make sure Norfolk Southern doesn't succeed.

"We have one advantage," a Norfolk Southern source said. "We bid and they didn't. We bet our railroad and our whole future; they didn't ante up."

Norfolk Southern already owns the Norfolk and Western and the Southern railway systems. It also owns about 3 percent of the Santa Fe Southern Pacific Corp., another giant railroad holding company. It is seeking government approval to purchase North American Van Lines.

CSX, however is bigger, with 1984 revenues almost double those of Norfolk Southern. Norfolk Southern's net income was higher, $482 million to $465 million.

CSX owns the Chessie System and the Seaboard System railroads and is in the process of acquiring American Commercial Lines, the nation's largest barge company. CSX Chairman Hays Watkins has told Dole he will oppose Noroflk Southern "in every forum."

But the bottom line, as railroad administrator Riley said, is, "This was the only transaction that is a long-term solution for the Northeast. It permanantly ends the instability for Northeast railroad, and it doesn't draw one cent off Conrail's balance sheet."