What’s more important for a healthy relationship: sleep or sex? The answer may surprise you.

Earlier this year, I was in a state of extreme sleep deprivation. I was stressed, and my young children were restless. For 18 months straight, I barely slept. My only opportunity to sneak in some shut-eye was the two-hour window after my kids dozed off.

Unfortunately, it was also the perfect opportunity to do something else.

For parents of young kids, time alone is rare. With so much to do and so little time, tough choices are inevitable.

But I didn’t even feel like I had a choice. Like most women, I’ve been told by countless relationship “gurus”— on websites, in magazines and across the table at brunch — to just push through my exhaustion, for my relationship’s sake.

After all, the risks of swapping sex for sleep are dire: We’re told our partners might look elsewhere for sex, or exit the relationship altogether. And there are so many ways to work around one’s need for sleep! A quick online search reveals handy “hacks” for reviving oneself pre-sex, plus plenty of guidance on the best “lazy” boudoir positions. So I pushed through — even though it was usually the last thing I felt like doing.

In my head, I heard so-called sexperts chorusing, “You’ll be glad you did!” But I wasn’t glad. I was just tired. Worse, I was starting to resent my husband.

Women are disproportionately targeted by this “power through” messaging, Laurel Steinberg, a New York-based clinical sexologist, tells The Post. In fairness, they’re usually the sleepier ones: “Men’s desire for sex seems to override any exhaustion they may experience,” the Columbia University psychology professor says. Because of this, she adds, women may feel more pressure “to acquiesce, even when exhausted.”

But women slogging through bedroom antics to please their partners is backfiring on men, too. Sarah, a 38-year-old mother from Maine, initially tried to work through her exhaustion like me — until she found that the experience was hurting her sex life, not helping it. “I felt turned off and a bit used,” she tells The Post. Thankfully, she was able to work it out with her husband, but you won’t catch her having snoozy sex again. “Telling women that their relationships will be at risk [if they don’t have tired sex] is immoral and manipulative,” she says.

Michael Aaron, a Manhattan-based psychotherapist, says that research aligns with Sarah’s experience: Relationships generally start to suffer when people prioritize quantity over quality, he explains. “People begin avoiding sex when it feels lethargic or obligatory,” he says. In other words, forcing yourself to have more mediocre sex makes sex less . . . sexy.

Also, it’s possible that your partner doesn’t want so-so snoozy sex any more than you do, adds clinical psychologist Alexis Conason. The New York expert believes that men can be just as negatively impacted by this gotta-get-it-done mentality as women. “We have a stereotype in our culture that men are always ready for sex and women are always too tired,” she says. But if a man isn’t in the mood, “his manhood is called into question,” she says. Everyone feels pressured by this must-have-sex dynamic, which can be suffocating and cause relationship issues.

Does all of this mean you should never have sex when you’re tired? Of course not, says Conason. If you genuinely want to give it a go despite your heavy eyelids, by all means, go for it. But “don’t just fall into the pressure. Honor what you want and need,” she says. And if you’re on the fence one night, remember this: “You need sleep in order to live and be healthy,” Aarons says. “No one has died from not having sex.”

*Sarah declined to use her last name for professional reasons.