The Library of Congress has agreed to lift its ban against five patrons who protested its new early closing hours and to pay their legal fees and costs of $4,500, in exchange for the patrons' agreement to drop their lawsuit against library officials.

Lawyers for both sides were informed yesterday that U.S. District Court Judge Harold H. Greene had approved the settlement of the lawsuit brought by members of the "Books Not Bombs" group. Greene issued an order last month barring the library from enforcing its ban, likening the practice to tactics used against apartheid protesters in South Africa.

The five library patrons were arrested in March after protesting the library's new 5:30 p.m. closing time, and were later given letters informing them that they were prohibited from entering the library until Oct. 1 because of their disruptive activity. Library officials have said the curtailed hours are the result of budget cuts mandated under the Gramm-Rudman-Hollings law.

The library agreed to rescind that action and to send the patrons letters saying, "We regret if our response to your activities . . . has unduly burdened you in the pursuit of your professional or scholarly endeavors."

"We won, no question about it," said the patrons' lawyer, Nina Kraut. "They realized from a legal point of view that their position was simply not justified at all."

Assistant U.S. Attorney Michael L. Martinez said, "The library just decided in weighing all the factors in this particular case it was better to try to settle the case . . . . They're not admitting they did anything wrong here."

Russell Mokhiber, one of the protesters, said the group planned to resume its sit-ins in a few weeks. "There will be a summer of protests until the Main Reading Room is opened again in the evenings," he said.