WASHINGTON — These Congress members are sleeping on the job — and defending their right to do it.

Crying poverty amid decade-long stagnant salaries and Washington’s steep cost of living, an increasing number of House lawmakers have turned into professional squatters at night, hitting the sack in their Capitol Hill offices — on everything from cots in closets to futons stashed behind constituent couches — to save a few bucks during the work week.

“Washington is too expensive,” said Rep. Dan Donovan (R-SI), who credits the cot that he sleeps on in a tiny alcove in his office as the reason he is able to serve in Congress while still paying his New York City housing costs.

“If we go to the point where you have to rent or have to buy [in DC], then only millionaires would be members of Congress,’’ he said. “I don’t think that was the intent of our Founding Fathers.”

But some of the penny-pinching pols’ colleagues are disgusted by what they call an unsanitary, undignified practice and want it banned.

Proposed legislation set to be introduced in the House as soon as this month would prohibit politicians from turning their offices into makeshift sleeping quarters, arguing that the move is violating IRS and congressional ethics rules.

“Look, it’s unhealthy. It’s nasty. I wouldn’t want to be entertained in somebody’s bedroom,” said Rep. Bennie Thompson (D-Miss.), who is among those spearheading the bill.

“Sleeping in your office is not proper’’ ethically, either, Thompson said. “You get free cable. Free electricity. Free janitorial. Free security. No rent. It’s a heck of a deal. It probably comes out to $25,000 to $30,000’’ a year that isn’t claimed at tax time.

‘If we go to the point where you have to rent or have to buy [in DC], then only millionaires would be members of Congress.’

For the slumber-party pols who catch their nightly zzz’s on office cots after daylong lawmaking discussions and fund-raising dinners, the issue is simple: money.

Many of them previously got extra compensation, or a per diem, when they served in their home-state legislatures to cover their living expenses while at the state capitol. New York state lawmakers in Albany, for example, get $175 for each day they are in town. In other large cities such as Sacramento, Calif., the daily stipend rises to $183, and in Austin, Texas, it is $190.

But as members of the House, US reps receive a salary of $174,000 a year — a figure that hasn’t increased in nearly a decade — and no housing allowance, while working in a city where a sparse one-bedroom pad can start at $2,000 a month. Meanwhile, they also have to pay to maintain a residence in their home state.

Members of the House and Senate leadership seem to fare better, if only because they rake in nearly $20,000 more a year, or $193,400. There are few if any known examples of senators bunking down in their offices overnight.

While there is no official tally of the number of House hobos who turn their offices into makeshift bedrooms, interviews with members and several Post stakeouts of the congressional gym — where the live-in lawmakers shower — put the estimate at around 100 representatives, or more than one-fifth of the governing body. Publicly, about 50 members have ‘fessed up to it.

Their ranks include everyone from House Speaker Paul Ryan (R-Wisc.) and Majority Leader Kevin McCarthy (R-Calif.) to New York Reps. Donovan, Gregory Meeks (D-Queens/LI), Lee Zeldin (R-LI), John Katko (R-Syracuse) and Brian Higgins (D-Buffalo).

Zeldin, a military veteran, said sleeping on a bed he stores in his office closet makes him more efficient.

“It must be the Army in me,” said the politician from Shirley. “Literally, from the moment I wake up from the moment I go to sleep, I’m just working without distraction. It’s just the way I’m wired.”

US Rep. Tim Walz (D-Minn.), also an Army veteran, said he previously rented an apartment in DC with then-US Rep. Patrick Murphy (D-Fla.) where they would each pay about $1,800 a month. That all changed when Murphy lost a Senate bid against Marco Rubio in 2016. Walz, a former teacher, said he now sleeps on an office cot.

“I’m not complaining,’’ he said. “It’s just figuring how to make all your finances work.”

A House member’s office usually has a reception area, a cramped section of work space for staff and a separate office for the politician with a seating area and desk. There is no kitchen or shower.”

What makes overnights in the office possible is Congress’ members-only gym in the basement of the Rayburn House Office Building. With an annual fee of roughly $300, members have access to showers, laundry and lockers.

A typical morning routine for the sleepover pols is to tuck away their makeshift bed and head to the gym for a workout. They then shower and usually get suited up there before their staffers arrive back at the office around 8 or 9 a.m.

“Nobody is going to see me like this,” said Higgins one recent morning at the gym while sporting earbuds, a long-sleeve T-shirt and workout pants.

The lawmaker from Buffalo said he used to split the rent for a basement apartment, paying $1,200 a month, but resorted to sleeping on a couch in his office when the college bills for his two kids began piling up.

“I don’t really view it as free housing,’’ he said. And “to be honest, it’s really convenient to the lifestyle. There’s a gym here. There’s a shower there. There’s a towel service there.

“There’s a laundry service for gym clothing.’’

US Rep. Austin Scott (R-Ga.) emerged from the congressional gym in sweaty scrubs after a workout and bemoaned efforts by his colleagues to ban office sleeping for budget-challenged lawmakers such as himself.

“I think it’s ridiculous,” Scott said. “I can’t afford an apartment.”

Rep. Adriano Espaillat (D-Washington Heights/NY) said couch-crashing isn’t for him, even though he, too, faces a high cost of living back home in New York City.

“My couch is too hard. I’d wake up with a stiff neck every morning,’’ the lawmaker quipped.

Instead, Espaillat said, he found an option: an apartment with rent well south of $1,800 in nearby Virginia.

“I’m probably one of the poorest members of Congress,’’ he said.

Rep. Jerry Nadler (D-Manhattan) also doesn’t sleep in his office, but he said he can sympathize with those who do — and worries that Congress won’t represent America if only wealthy people can afford to serve. He supports a cost-of-living hike for members’ salaries, which haven’t increased since 2009.

But some House members, including New York’s Rep. Claudia Tenney (R-Utica/Rome) and Rep. Nydia Velazquez (D-Brooklyn), balk at any hint of increasing congressional members’ bottom lines.

The issue is a particularly sticky one for lawmakers, who already take heat from constituents for what are seen as Washington’s bloated spending habits.

“We don’t deserve to talk about a pay raise for Congress until we balance the budget,” said Rep. Ken Buck (R-Colo.).

Mississippi’s Thompson, who is one of those sponsoring the bill to ban congressional sleepovers, said he recognizes that either way, something has to change.

With the support of the Congressional Black Caucus, Thompson is asking the government to issue a report within 180 days on the feasibility of converting any unused space into a dorm for members of Congress. But he doesn’t agree with a pay raise or per diem for Congress, at least at the moment, according to his office.

As for those who continue to sleep in their offices, they should be hit with a tax burden, Thompson said. Those lawmakers’ living arrangements should be considered an “accrued benefit’’ in terms of the IRS, he said.

“I sympathize with the members’ situation. But they knew what the salary was when they came. And now they found a way around it,’’ said Thompson, adding that he pays $1,800 for a small studio apartment in the area for himself.

Calling the office-sleeping “public housing,’’ he added, “I personally see it as a way of beating the system.’’

Democratic Rep. Betty McCollum of Minnesota said she’s open to considering a housing stipend, although she wants the office sleeping to end — now.

“I wasn’t allowed to sleep in the classroom when I was a teacher or in the furniture department when I worked at Sears,” she said.

Rep. Robin Kelly (D-Ill.) said she would consider either a wage hike or housing stipend, calling it a matter of equality.

“I think that too often the indirect costs of serving in Congress, in particular housing in the DC area, can prevent many good candidates, especially women, people of color and working-class individuals, from running,” Kelly said.

Instead of a pay raise, Minnesota’s Walz suggested turning former dormitories once used for the teenaged congressional pages into housing for members of Congress, a la Thompson’s study.

Higgins said he believes that Thompson’s bill is all about forcing Congress to approve a per diem. And he’s not complaining.

“People have a perception that we get free health care, and after our term, we get our full pay — none of which is true,’’ Higgins said. “It’s odd that Congress takes such efforts to undermine its own integrity as opposed to standing up for themselves as an institution.”

Still, he took issue with the idea of taxing members of Congress who currently sleep over.

“I don’t know if you can call [sleeping on a couch] a benefit,’’ Higgins said.

Some female members of Congress suggested that the practice of converting a House member’s office into personal overnight accommodations isn’t just a matter of hygiene or ethics.

“Imagine if you are a staff member and you have to knock on the door,’’ said Rep. Jackie Speier (D-Calif.), who is helping to draft the preventative legislation with Thompson.

“Are [their bosses] going to be in their skivvies? It’s just not consistent with the position they have.”

Only three female US representatives are known to sleep at night in their offices: Kristi Noem (R-SD), Lynn Jenkins (R-Kan.) and Jaime Herrera Beutler (R-Wash.).

But Higgins said that to make any connection with the anti-sex-harass #metoo movement “is a stretch.’’ Couch-crashers work later than their staff because of their in-house sleeping arrangement, then rise early and are dressed long before any aides arrive, he and others said.

“If you are respectful of people, you are going to make sure that you don’t put anybody in an uncomfortable situation,’’ the rep said.

Lawmakers who sleep at the office say their less-than-ideal living arrangement is not a matter of choice — and frankly, it can be embarrassing.

Staffers with US Rep. Keith Ellison, deputy chairman of the Democratic National Committee, didn’t respond to questions about whether he sleeps in his congressional office. But he was furious to have been caught — disheveled and carrying his dress shirt and a bag of clothes — by The Post heading to the gym one morning.

“I just really deeply resent you guys camping out here,” Ellison (D-Minn.) said. “It’s so wrong.”

He proceeded to complain to Capitol staff about accredited press being in the taxpayer-funded building. Ultimately, no security personnel asked The Post to leave.

Rep. Mark Sanford (R-SC), who keeps a futon mattress behind his office couch and lays it on the floor at night to sleep, acknowledged that the situation isn’t comfortable.

But he said he refuses to get a DC home because he doesn’t want to be sucked into the Washington “swamp.”

“You can Google my net worth — I’m not [office-sleeping] for the rent money,” said Sanford, whose net worth Roll Call estimated to be $2.6 million. “I’m doing it because it’s practical and it helps me be more effective.”

“By the end of the week, you are ready for a real bed,” he admitted. “It keeps it very clear in your mind where home is — and where home isn’t.”