It was the diapers, not her trip to space, that made Lisa Marie Nowak a national sensation.

When the former astronaut was arrested in 2007 for stalking and assaulting her ex’s girlfriend, she had quite a few eyebrow-raising items in her possession: pepper spray, a mallet, a knife, a BB gun, a map to the house of her romantic rival. Details of her actions were equally stunning: On Feb. 5, she had followed the woman, Air Force Capt. Colleen Shipman, out of the Orlando airport and to her car, where she pepper-sprayed her in the face before Shipman managed to drive away and get help.

In spite of all this, it was the fact that Nowak had worn adult diapers on her nine-hour rage drive from Houston to Orlando that caught fire in the public consciousness. “Astro-Nut!” screamed headlines, accompanied by a mug shot of the once-triumphant shuttle crew member disoriented and disheveled. It was a stunning fall from grace for a woman who had spent so much of her life dreaming of making history as one of the few women to journey to the stars — and who had achieved her goal only a year before.

A new movie, “Lucy in the Sky,” out this week, stars Natalie Portman as a fictionalized version of Nowak. But it’s catching flak for removing the diapers from the scenario, begging the question of why one would make a movie about such a well-known piece of recent history without including the very thing that made the story so indelible.

One true-crime expert on Nowak thinks she knows why: “They didn’t want her to become a punchline,” Diane Fanning, author of “Out There,” a 2007 book about Nowak’s life story and tragic downfall, told The Post. She also thinks the truth around that sordid diaper detail needs clarifying.

“As an astronaut, the fact that she wore a diaper was the most normal part of that whole expedition,” said Fanning, who did not have access to Nowak herself for her research. “That’s something she was used to. That was something all astronauts did — it wasn’t peculiar. When you do takeoff, and you have all that pressure pressing against your body, it presses against your bladder, too — and boom, everything goes out. You’re gonna wet your pants, so it’s good to have a diaper on.”

Fanning maintains that wearing diapers wasn’t a sign Nowak had gone around the bend — it was an indication that she could never let go of being an astronaut.

Born Lisa Caputo in 1963 in Washington, DC, Nowak always wanted to be an astronaut.

“Growing up, she was competitive, ambitious, a perfectionist. Not somebody who seemed destined to self-destruct. She excelled throughout school; she ranked high in student government; she went to church. And she dreamed about walking on the moon,” author Claudia Kalb, a childhood friend of Nowak’s, wrote in Newsweek two years after the arrest.

Nowak was accepted into the US Naval Academy in Annapolis, Maryland, where, Fanning says, she faced treatment that would send less determined women screaming for the exit.

“It was one of the early years that women were allowed,” said Fanning, “and there was a lot of anti-female pressure. Some of the professors would stand there in front of a class, with female students looking right at them, saying, ‘I don’t think women belong here.’”

Nowak persevered, eventually becoming a naval flight officer in 1987. She was also starting a family with husband Richard Nowak, who’d been a classmate at the Naval Academy. In February 1992, their son was born, and in March, she earned a master’s degree in aeronautical engineering, said Fanning, adding that the following September, she also earned a degree in aeronautics and astronautics. “It’s like, who does all that at the same time?”

When Nowak made it into NASA’s Astronaut Corps in 1996, she was finally close to achieving her dream. She also continued to juggle responsibilities: She and Richard had twins girls in 2001, although the constantly busy mom was compelled to leave much of the parenting to her husband.

In 2003, the space shuttle Columbia disintegrated upon re-entry, killing its seven crew members — including Nowak’s best friend, Mission Specialist Laurel Clark.

“Instead of taking time to grieve about that, she became the grief counselor for that woman’s family,” said Fanning. “That was another blow to her home life — she wasn’t home to see her husband and kids, wasn’t taking care of herself.”

Shortly afterward, Nowak began an affair with a fellow astronaut, William Oefelein, who Fanning says was known as “Billy O.” He was a notorious player, the type of cowboy astronaut depicted in Tom Wolfe’s 1979 book about the space program, “The Right Stuff.” Nowak and Oefelein initially became close on a training mission for surviving in extreme cold temperatures, Fanning claims — then started a romantic relationship afterward.

“Here was someone who had to work a lot and had to be away from the kids a lot and dump everything on her husband and not see him very much, and I think it pushed them apart,” said Fanning.

In 2006, Nowak’s dream of going to space finally came true. She was a mission flight engineer on the space shuttle Discovery (Oefelein was not a crew member), and operated a robotic arm for a number of spacewalks on the shuttle’s 13-day mission in July of that year.

“Everything was good” on the mission, said Fanning. “I mean, yeah, there was a certain amount of tension, since this was only the second flight since the Columbia disaster, but it was glorious.”

After the mission was over, though, there was no second flight on the horizon for Nowak: The shuttle program was winding down, and there were way more astronauts available than there were flights scheduled.

“All the former astronauts I talked to said [going to space] was even more incredible than they’d dreamed,” said Fanning, “and there was a strong feeling of not ever wanting to come back. And when you did come back, you just yearned to go again.”

In the aftermath of Nowak’s flight, with an uncertain career path and a failing marriage in front of her, she got more bad news: Oefelein had fallen for Colleen Shipman, and told Nowak in 2007 he was breaking up with her.

At that point, something in this stunningly accomplished, type-A woman snapped. Or had this been a long time coming?

“After the confrontation with Shipman,” Kalb wrote, “Nowak received a slew of mental-health diagnoses. On the list: obsessive-compulsive disorder, a single episode of severe depression, insomnia and Asperger’s disorder. This last one, especially, caught my eye. I remember Lisa as a cheerful person with a ready smile, but she was also reserved and private and somewhat impenetrable. We took classes together, celebrated birthdays together, but I can’t say she ever confided in me. Nor did she seem to take a huge amount of joy in the closeness and wonder of teenage friendship.”

Kalb also wonders if Nowak was changed by her flight and — much like Portman’s character in “Lucy in the Sky” — was simply unable to recalibrate in the months that followed. “Was it simply jealousy, the ‘injured lover’s hell’ of ‘Paradise Lost’? Or could it have been the challenge of adapting to Earth after space?” Kalb said.

Indeed, recent studies have discovered that space travel alters the human body in ways we’re only beginning to understand. Last year, a study found astronaut Scott Kelly’s DNA had been altered by 7 percent after spending nearly a year on the International Space Station. NASA has also begun to warn that astronauts can be prone to mood alteration and depression.

“Extensive psychiatric and psychological evaluations are performed as part of the astronaut selection process,” read a NASA release following Nowak’s arrest, which went on to say that there would be an “internal assessment of our practice of behavioral medicine” to see if improvements needed to be made.

Ironically, in the aftermath of Nowak’s assault on Shipman, her lawyer argued in court that adult diapers had never entered the picture. “The biggest lie in this preposterous tale that has been told is that my client drove from Houston, Texas, to Orlando, Florida, nonstop, wearing a diaper,” said her lawyer, Donald Lykkebak. He said diapers found in the car were left over from 2005, when the Nowaks packed the car for a hurricane evacuation with the kids.

Whatever the truth, it’s this relatively insignificant but taboo-breaking detail that will follow Nowak — who is now reportedly living a quiet life in Texas, where Fanning speculates she may be a teacher — forever.

After initially facing charges of attempted kidnapping, burglary and battery, Nowak ultimately ended up charged with, and pleading guilty to, felony burglary and misdemeanor battery, sentenced to a year of probation and two days of jail time already served.

She delivered an apology to Shipman at her hearing. “I am sincerely sorry to cause fear and misunderstanding and all of the intense public exposure … I hope very much that we can move forward from this in privacy,” said the 46-year-old Nowak, directly facing Shipman. Nowak did not reconcile with her husband; they officially divorced in 2008.

“To see her fall so far was a real tragedy,” said Fanning, who grew fond of her subject while chronicling her misdeeds and the life that led up to them. “That’s why I dedicated my book to anyone who’s ever done anything stupid in the name of love.”