A federal bankruptcy judge yesterday backed the proposed sale of United Press International to a Mexican newspaper publisher, turning aside last-minute efforts to derail the plan.

Judge George F. Bason refused to reopen the bidding process for the financially strapped news agency and cleared the way for the sale of the company to Mario Vazquez Rana and his junior partner, Houston developer Joe E. Russo, for $41 million.

The decision, which follows weeks of legal skirmishing over the Vazquez plan, will trigger an immediate infusion of cash that management says is needed to meet its operating needs. UPI officials said the decision also should boost staff morale and client confidence in the wire service, which they have testified has been sagging because of the continuing cloud of uncertainty over the company.

Vazquez's bid was endorsed last month by UPI management, its union and a committee of creditors in a joint announcement that appeared to bring to a close a six-month process aimed at finding a buyer for the company. However, a campaign by Financial News Network, leader of a rival consortium of bidders, to press its bid threatened to unravel the coalition.

Bason effectively halted this campaign yesterday after a marathon hearing that lasted throughout the weekend and that brought many of the key principals, including Vazquez, to the witness stand.

First, the judge approved the preliminary agreement for the sale of UPI to Vazquez on the condition that Vazquez agree not to assume the powers of chief executive until the court approves a formal plan of reorganization.

Under the agreement he reached with UPI management, Vazquez was supposed to replace Luis Nogales as chief executive officer as soon as the judge approved the agreement, but the judge said the provision would violate an order he signed last spring keeping Nogales in charge until he approves the final plan to bring UPI out of bankruptcy proceedings.

Bason ruled that he will reopen the bidding process that Financial News Network had alleged was unfair only if Vazquez refuses to keep Nogales as chief executive officer.

The judge said that the procedures of the bidding process were generally not within the court's purview, but he also denied FNN's contention that it had been unfairly denied a 48-hour extension to revise its bid. Testimony by Nogales and FNN Chairman Earl W. Brian showed that, at most, there had been a "misunderstanding" about the process, he said.

George Weathersby, a representative of Vazquez, told reporters after the hearing yesterday that he had to consult with Vazquez, who reportedly is traveling in Europe, before commenting on the judge's condition for approval. He said, however, that he is optimistic the matter can be worked out, while Nogales said he expects UPI and Vazquez to be able to satisfy the judge's concern.

The main remaining option open to FNN is to appeal Bason's decision to U.S. District Court. Neal A. Jackson, an FNN lawyer, said last night that "a wide range of procedures are being considered," but he declined to elaborate.

If the judge goes ahead and approves the agreement, Vazquez immediately would inject at least $2.5 million into the company over the next six months and provide a $25 million line of credit -- a short-term infusion that UPI officials say is critical to the company's survival. UPI executives had testified over the weekend that the company was projected to lose about $600,000 during the last three months of the year and could face a cash shortage.

"We have a slight negative cash flow. What this will do is assure that we can meet our operating needs," Nogales said.