The board of directors of Trans World Airlines Inc. voted unanimously yesterday to auction off the airline within the next 60 days.

The company made the decision after a federal judge in New York refused to block the previously announced $18-a-share bid for the company by corporate raider Carl Icahn. The directors formally rejected Icahn's $600 million bid yesterday, saying it "does not reflect full value for the company."

Officials of TWA, the fifth-largest domestic airline, said that if they do not receive an offer that they believe is superior to Icahn's bid within 60 days and certain other conditions are met, they will submit Icahn's $18-a-share bid to TWA shareholders for a vote. The company previously said it did not believe Icahn's bid was in the best interest of employes or communities served by TWA because Icahn might sell airplanes and routes to help finance the purchase.

"In order to maximize value for TWA shareholders, the board has instructed the company's management and its financial adviser, Salomon Brothers Inc., to actively pursue alternatives that would afford the company's shareholders an opportunity to participate in a transaction superior to the Icahn proposal and that would also be in the best interests of TWA's employes, the communities it serves and the traveling public," the board said in a statement released after the close of the stock markets.

TWA said that, because it is willing to submit the Icahn proposal to its shareholders if no superior offer is received, the company expects Icahn not to "thwart the board's efforts." Icahn, who could make a handsome profit on his TWA shares if the company finds a buyer willing to pay more than the $18 a share he is offering, said yesterday he did not want to comment on his future strategy until he has had a chance to study TWA's announcement with his legal and financial advisers.

Other parties apparently are interested in buying TWA. The company said yesterday that, in reaching the decision to sell the company in an auction conducted by Salomon Brothers, "it took into account expressions of interest from others received to date." The company also indicated it believes a higher bid than Icahn's is justified because of the positive impact that a favorable settlement of its current union negotiations would have on its long-term financial prospects.

TWA had revenue of $3.7 billion and net income of $29.9 million last year, the company's first profitable year since 1980. The airline lost about $50 million from 1981 through 1983.

While TWA's aggressive legal effort to block Icahn apparently will not prevent the company from being sold, it has given the airline time to plan the sale in a controlled fashion and time to take care of its top executives. In recent weeks, TWA has added "golden parachutes" for 29 executives, bringing to 32 the number of executives who may be eligible for those lucrative compensation arrangements if the company is sold.

Icahn said yesterday he was "gratified" by U.S. District Judge John M. Cannella's decision to deny TWA's motion for an injunction against his takeover bid. Icahn, who initially told TWA management that he thought the company should sell some of its planes and routes, reiterated yesterday that he no longer holds that view.

"I have absolutely no plans or intentions to liquidate TWA's business or its fleet of planes or to cause widespread layoffs or to curtail its routes or its St. Louis or Kansas City facilities," Icahn said yesterday. But Icahn's Securities and Exchange Commission filings indicate that, if TWA's earnings and cash flow are not sufficient to repay the debt that would be added to the company's balance sheet to finance his proposed takeover, he would "explore alternative financing sources, including the possible sales of assets."

TWA said it would submit Icahn's bid to its shareholders for a vote after 60 days only if it does not receive a superior proposal, Icahn receives firm commitments for all of the financing needed to complete his proposed takeover, the Department of Transportation raises no objection to Icahn's fitness to operate an international airline and there are no other legal restrictions in effect.

The giant airline, which has been critical of Icahn's takeover bid, said it would communicate its views "as to the merits of the Icahn proposal" after 60 days if it does not receive a superior offer.

Icahn filed papers yesterday in opposition to TWA's request for a "fitness investigation" by the Department of Transportation. TWA has asked the agency to determine whether Icahn is "fit" to operate the airline.

"TWA's concern is not with the present or future fitness of the airline, but rather the preservation of its existing managment," Icahn said yesterday in his DOT filing.