United Airlines and the striking Air Line Pilots Association yesterday reached a tentative agreement to end the 28-day-old walkout that has grounded 85 percent of the flights of the nation's largest airline.

Details of the settlement were not disclosed in the National Mediation Board's announcement. The agreement requires approval by ALPA's 30-member United executive council before the 5,000 pilots -- and 8,000 flight attendants who supported their strike -- return to work.

Company and union sources said the key to the agreement was a decision by both sides to allow U.S. District Court Judge Nicholas Bua in Chicago to rule on thorny back-to-work issues that kept the strike going after an economic settlement was reached May 24.

The central dispute, according to both sides, involved United's plan to give 270 union pilots who crossed picket lines more seniority than strikers, and the airline's refusal to hire 570 new pilots whom it trained but who refused to work when the strike began May 17.

If the tentative settlement is approved and no last-minute problems arise for the 10,000-member Association of Flight Attendants, strikers could begin returning to work by the weekend, officials said.

The airline would need approximately a week to return to full service -- 1,500 daily flights to 149 cities and 10 overseas locations. United, which carries about 15 percent of all U.S. air travelers, has been flying about 210 flights daily to 50 cities during the strike.

The breakthrough came after the company, which refused last week to return to mediation, agreed to resume talks late Tuesday with National Mediation Board Chairman Helen M. Witt and chief mediator Ralph Colliander.

The unannounced mediation session at a Chicago hotel concluded about 2 a.m. yesterday with the tentative settlement after officials spoke by telephone to United Chairman Richard J. Ferris, who was in Asia.

United Vice President Monte Lazarus said the company returned to mediation after ALPA "pulled the demand" that the company hire the 570 new pilots and agreed to "let the judge decide" the legal rights of the company, the union and the pilot trainees on the back-to-work question.

The settlement involved "face-saving" by both sides by deferring to the courts, according to Sen. Alan J. Dixon (D-Ill.), one of a handful of government officials who talked with both sides during the strike.

"The face-saving issues are sometimes the most difficult," he said.

The strike, which was estimated to be costing United $5 million to $10 million a day and was threatening ALPA's future, began over the company's demand for a two-tier wage scale under which newly hired pilots would have been paid considerably less than veterans for a 20-year period.

United, despite record operating profits of $564 million in 1984, said the extended two-tier system was crucial to continued profitability because other carriers, union and nonunion, had similar systems and considerably lower pay scales.

United's pilots, who on average earn about $90,000 a year, agreed to a compromise setting up two tiers for six years, after which an arbitrator would determine the scale for the next six years, sources said.

But after that agreement, talks broke off on the back-to-work issues, and Ferris said United would "rebuild" with replacement pilots. He had said his plan depended on the 570 new hires and a substantial number of striking pilots returning. When the pilots remained solidly in ALPA's camp, United's rebuilding plan was slowed.

ALPA filed charges of unfair labor practices May 16 in federal court over alleged contract violations by United. A decision by Bua is expected shortly, but both sides have reserved the right to appeal, according to Lazarus. It was unclear what the back-to-work terms would be prior to a final court ruling.