Homeless encampments underneath Lake Shore Drive viaducts in Uptown will have to clear out in time for overpass construction work that’s set to begin on Monday, U.S. Magistrate Judge Sidney Schenkier ruled on Friday.

Schenkier also knocked down a request for holdout “Uptown Tent City” residents to move their tents to a park nearby. The ruling, activists fighting for the homeless said, will allow the city to displace at least 75 people below overpasses at Wilson and Lawrence avenues.

The homeless residents, who so far have refused to leave their camps for spots offered by the city in shelters, have legitimate needs for help, Schenkier said.

But the courts are unable provide a solution under federal law.

“I don’t think there is anybody in this room that doesn’t have sympathy and concern” for the plight of the homeless, Schenkier said. “My hope is the parties will continue to work with the city . . . to find a solution to this serious problem that isn’t just in Uptown, or Chicago.”

The ruling ends a months-long standoff between the city and tent city residents over the construction project, which will make repairs to crumbling viaducts — and also add bike lanes that will leave no place for the homeless to return to after construction is finished.

A lawsuit in Cook County Circuit Court that challenges the redesigned overpasses has been filed, but a judge there has said that construction would not be stalled by it.

The 70-plus people who have stayed in tents even as the city offered up spaces at shelters across the city have said they prefer living conditions under the overpasses to the shelters, which they described as unsanitary and often unsafe compared to the tent community they had built.

A spokeswoman from the city Department of Family and Support Services said that City Hall has been working to relocate the Uptown homeless for 18 months and has been at the sites on a daily basis recently. Outreach efforts will continue over the weekend.