The Auto-Train was rescued from bankruptcy yesterday when a group of private investors led by J. William Middendorf II agreed to buy the operating assets of Auto-Train Corp. and keep the train running.

Middendorf and half a dozen other investors have signed an agreement in principal with Murray Drabkin, who was appointed by federal bankruptcy court to run the railroad after Auto-Train Corp. filed for reorganization in bankruptcy last fall.

Drabkin announced signing of the agreement but disclosed no details of the deal, which must be approved by the federal bankruptcy court.

The announcement indicated Middendorf's group will acquire only the trains, terminals and headquarter facilities required to run the Auto-Train, rather than the entire Auto-Train Corp., with its other assets and liabilities.

A spokesman for the buyers said Auto-Train has been making money for the past few weeks and they are confident the Washington-to-Florida rail service can be made a viable business with proper management.

Middendorf is president of Financial General Bankshares Inc., the holding company that owns the First American Banks here, and recently was chosen by President Reagan to be United States ambassador to the Organization of American States. Middendorf will be only an investor in Auto-Train and will not be involved in the company's operation if he is confirmed as OAS representative, a spokesman said.

Besides Middendorf, the Auto-Train investors include H. Robert Ferneau, a Financial General vice president and long-time associate of Middendorf; Langhorne Washburn, a former assistant secretary of Commerce; Carl Shipley, former chairman of the District of Columbia Republican Party; attorneys G. James Frick, John Campbell; and Walter Sohier and John Loeb, Jr., of the Shearson Loeb Rhodes investment family.

Several members of the group last November loaned Auto-Train $400,000 under an agreement that could give them 26 percent of the corporation's stock.

Under the latest investment plan, the group reportedly will put up $1.3 million to acquire Auto-Train's most valuable asset -- the franchise to run the train itself. Auto-Train Corp. also has rail car repair facilities in Tidewater Virginia and a terminal in Kentucky which are not included in the deal.

Bankruptcy trustee Drabkin recently put the car shops and terminal up for sale along with the plush private railroad car that has become a symbol of the management problems that led Auto-Train to bankruptcy. In 10 years of operations, Auto-Train made sporadic profits, but supplied its top executives with the private car, a Florida condominium and limousine.

Shortly after he was named to oversee the railroad's reorganization, Drabkin fired Auto-Train's founder and chairman, Eugene Kerik Garfield, and most of the other top officers.

Middendorf's group reportedly plans to hire a veteran railroad executive to manage Auto-Train. The buyers already are negotiating new agreements with Auto-Train's principal suppliers -- the Seabord Coast Line and Richmond Fredericksburg and Potomac railroads, whose tracks Auto-Train uses, and Marriott Corp., which supplies food and beverages on the train.

Because they are buying Auto-Train's operations rather than the corporation itself, the Middendorf group will have to get permission from the Interstate Commerce Commission to run the train.

The sale of the corporation's principle asset will provide some cash for Drabkin to repay the railroad's debts, which total several million dollars.