A Herald Square subway corridor has become a homeless encampment.

More than a dozen sleeping homeless men and women nightly occupy the corridor linking the 34th Street station to the PATH train platforms.

Flattened pieces of cardboard, dirty blankets and luggage line the crowded, 20-foot-wide, block-long passage.

“It’s like the bad old days,” an NYPD cop lamented as he walked through the tunnel last week.

With some 60,000 people packing city shelters every night — a record high — the foul-smelling underground hall has become a hotel for the desperate.

“The shelter system sucks,” said one woman who has been living in the station for a month and a half.

The homeless population in the subway system stood at some 1,800 last winter, according to the city’s annual survey for 2014. That is about 1,000 more people than were counted in 2005.

Mayor de Blasio has been so frantic to solve the increasing problem that he made robocalls to landlords this month offering $1,000, plus city money for rent, if they take in homeless families.

The occupants of the Herald Square station — a busy nexus of seven lines plus the PATH trains to New Jersey — say they are largely left alone, as long as they are past the sign that says “Welcome to NYC Transit.”

That side of the corridor is run by the MTA and patrolled by the NYPD while the other portion is the territory of Port Authority cops who are more likely to roust them, some of the homeless told The Post.

One Port Authority officer ripped the cardboard from under a sleeping man a few weeks ago, a woman told The Post.

“He did nothing wrong,” she said of the man. “We yelled for someone to get a camera.”

She said the NYPD moves the encampment only when it’s time for the MTA to clean the corridor.

“But they’re not violent,” she said.

Another woman, sitting on top of an oversized duffel bag with more bags to her side, said she has made the passageway her home since the weather turned harsh in January.

“I don’t think anybody wanted to put anyone out,” she said.

The MTA acknowledged that the station was one of its homeless “hot spots” that has generated complaints from subway riders. The agency has sent outreach workers to Herald Square to try to persuade the occupants to seek shelter elsewhere.

“As soon as we convince some to enter the shelter system and accept services, more come in and take their place,” said MTA spokesman Adam Lisberg.

Cops are not mandated to take “enforcement action” when they encounter a homeless person in the subway system, said a department spokeswoman, who added that a special NYPD unit conducts joint patrols with an outreach agency.

Port Authority cops ask homeless people “not to lie down in the passageway on cold nights because of the need to keep the walkway clear, and to relocate on warmer nights,” said a Port Authority spokesman.