Two feuding Northern Virginia bus lines reached a truce in federal Bankruptcy Court in Alexandria yesterday over which company can carry Prince William County commuters in and out of the District.

Under the agreement, the financially troubled Colonial Transit Co. will eliminate its service into the District and will terminate all its runs at the Pentagon, effective Monday. In return, its competitor, Washington Motor Coach, will transport Prince William commuters directly into the District, without any stops in the close-in suburbs.

"That's just fine with us, it's what we hoped for," said Colonial's lawyer John E. Drury.

The company, which has filed for protection under bankruptcy laws, had planned to eliminate all its District service Aug. 1, but it had challenged Washington Motor's efforts to take over some of its runs before then.

"I really like these self-solving problems," said Bankruptcy Judge Martin V.B. Bostetter Jr. as attorneys for the two companies and Prince William County laughed and shook hands in his court.

The dispute between the two lines had left as many as 200 commuters stranded in the District last Friday after Bostetter issued a temporary order blocking Motor Coach from returning to Washington to pick up passengers its buses had left there in the morning.

Earlier yesterday, Prince William County and Motor Coach attorneys won authority from the Interstate Commerce Commission allowing the Arlington-based company to provide emergency service to county commuters for 120 days.

Prince William's lawyer Sharon Pandak, who asked the judge to allow Motor Coach to continue its operations in the county, said Prince William was "not here to champion Washington Motor Coach, but to point out Prince William commuters need to have adequate bus transportation ensured."