If you knew that you had only a short time left to live, how would you spend it?

That’s the question Nikki Boyer poses at the start of “Dying for Sex” — a fascinating, six-part podcast by Wondery. Concluding March 11, the series follows the wild sexcapades of Boyer’s best friend, Molly, who was diagnosed with Stage 4 terminal breast cancer at 41.

Upon receiving the devastating news, Molly — who’d battled breast cancer once before, in 2011 — leaves her unsatisfying marriage to explore her sexuality and fuel her dwindling vitality.

“Sexually, we had difficulties before cancer came along [the first time],” Molly, whose last name is being withheld for privacy reasons, says of her marriage. “Right before I got diagnosed, I was kind of looking to recharge our sex life . . . and then cancer showed up.”

They never got back on track after her first round of treatments, which consisted of a double mastectomy, radiation, chemotherapy and reconstructive surgery. Still, they stayed together — until Molly’s second diagnosis.

Her medication came with some surprises. Unlike chemo and radiation, it didn’t ravage her body. In fact, if you didn’t know Molly, you wouldn’t know she was sick.

The meds also put her libido in overdrive.

“I was horny all the time,” she says. “[My body] needed to be touched.”

So she left her husband — and catapulted herself into the dating scene, a series of adventures and misadventures that she shares with her best friend on the show. Like a “Sex and the City” brunch with chemo instead of Cosmos, the pair candidly gab about Molly’s conquests: the Ryan Reynolds lookalike who’s into masochism, the at-home massage with an accidental happy ending, an awkward car romp with a guy who couldn’t contain — or maintain — his enthusiasm, and the mortician she made out with while he was in full clown makeup. In one episode, the pair tries to count the number of suitors in Molly’s phone. They quit at 183.

“Sex,” Molly says, “makes me feel alive — and it’s a great distraction from being sick.”

“She’s sexually and emotionally open and nonjudgmental,” Boyer tells The Post of her best friend. The pair met 20 years earlier in a New York City acting class. “She said [the dates] were helping her feel alive. She was reclaiming her body.”

Boyer says the idea for the podcast came one day in 2018, when she picked up Molly for lunch at noon.

“I said, ‘Why do you look really cute?’ She said she had already been on two dates,” says Boyer, who explains that the meds also disrupted her sleeping habits, making her wake up at the crack of dawn — and giving her more time to date. “One guy had gotten in from the night before and they met for coffee at 6 a.m. And she had breakfast with the next guy. I said, ‘There’s a story in here’ . . . Sex and illness are rarely discussed together.”

Molly jumped at the chance to talk about her experience — even if she sometimes had to cancel recording sessions because she couldn’t get off the bathroom floor.

On the podcast, Molly’s health issues are handled with dark humor — a balm for speakers and listeners against cancer’s harsh physical realities. In one episode, Molly explains why she allowed some men she met online to come to her home. “What are you going to do to me? Kill me? I’m dying.”

They speak freely on the podcast of her medical treatments, her diminishing lung capacity and the blood clots that landed her in the hospital while doubling the size of her leg. But Molly never reveals her fragile medical situation to any of her dates — or her other friends.

“Telling her story [on the podcast] was important because she didn’t want her identity to be cancer and walk into a room to have people say, ‘How are you?’ She kept it a secret,” says Boyer, an actress who also co-hosts the podcast “Straight Talk With Ross Mathews.”

The subject matter can be explicit and takes unlikely twists. Although sex is the entry point, it’s not the climax of the series.

“It’s not just about the sex,” Boyer says. “It’s about healing old wounds and coming to terms with what is happening to her. Sex, for her, was not the endgame.”

“Dying for Sex” is also a celebration of female friendship in the face of the unthinkable. The pair’s mutual love and devotion is what the kids nowadays call “goals.”

Ultimately, Boyer wants others to be inspired by Molly’s journey.

“People can think all day about what they would do, but you never know what life will throw at you and how you will react . . . What’s on your bucket list? What do you want to live for?

“My hope is that people nurture their relationships,” Boyer says. “Don’t wait for someone to tell you they’re dying.”