In the 1980s and ’90s, Madonna was the embodiment of young rebellion — appearing nude in Playboy, fellating a water bottle in her film “Truth or Dare,” angering the Catholic Church with her provocative videos and lyrics. She wore a wedding gown and “boy toy” belt buckle; hooked up with Sandra Bernhard and Sean Penn; and published a book of soft-core porn with pals like Vanilla Ice.

So it might be karma that her biggest challenge today is keeping her own kids in line.

Insiders say her two teenagers, Rocco and Lourdes, are fed up with the Material Mom’s mixed messages — and they’re acting out their frustration. They “crave stability,” says a Guy Ritchie source, but their mother’s relentless touring schedule has made that difficult. Multiple insiders note the children also feel Madonna is “too controlling.”

Most notably, the family is suddenly embroiled in a custody dispute between Madonna and her ex-husband, film director Ritchie, over their 15-year-old son, Rocco. After the teen stubbornly resisted Madonna’s demands that he return from his father’s London home to the Big Apple for the holidays, she took her beef to a higher power: A Manhattan Civil Supreme Court judge ruled that Rocco must return to New York before the January start of his school session at Lycée Français de New York.

So far, Rocco has refused, remaining in England with his dad, stepmother and three half-siblings. A hearing will be held Feb. 3 to resolve his future. But Rocco has made clear his intentions, telling a friend on Instagram, “I’m staying here, bro.”

A movie associate of Ritchie’s tells The Post that Rocco grew mad at Madonna’s stern and controlling manner and turned into a rebel heir during her ongoing Rebel Heart tour.

“Rocco spent most of the second half of 2015 on tour with his mother and got upset about not spending enough time with her,” said the source. “Even by her ruthless standards, Madonna has been particularly driven on the tour, and when Rocco did see her, he felt like she was trying to micromanage his life.”

“When he’s in England, [Rocco] gets to live a low-key life . . . He can go about his business and talk to girls without paparazzi stalking him, as Guy has carved out a pretty private existence for his family,” says another Ritchie pal. “He finds making friendships in New York much more difficult. Over here, everyone [is] trying to score an invitation over to Madonna’s house.”

Adds the Ritchie film colleague: “When he stays with his father . . . Rocco is allowed to play guitar until the early hours of the morning. Guy does have rules, but he had zero confidence growing up and wants his son to feel as empowered as possible.”

It’s all a far cry from Madonna’s parenting philosophy.

When it comes to bringing up her kids, the 57-year-old wild child is an old-school disciplinarian. She enforces strict rules for her brood — daughter Lourdes, 19, from her relationship with Carlos Leon; Rocco; David Banda, 10, whom she adopted with Ritchie from a Malawi orphanage; and Mercy James, 9, also adopted from Malawi.

Madonna’s kids must follow the hard-core macrobiotic diet that she herself abides by. Sweets and chocolate are outlawed, along with dairy products, salt and preservatives. TV is banned and Lourdes got an iPhone only after turning 15. If the kids leave clothes on the floor, the items are taken away.

Speaking a decade ago about Lourdes getting in trouble for her sloppiness, Madonna explained: “She has to earn all of her clothes back by being tidy, picking up things in her room, making her bed in the morning . . . She wears the same outfit every day to school until she learns her lesson.”

Biographer Lucy O’Brien says the Detroit-raised singer inherited these old-school parenting values from her French-Canadian mother (also called Madonna), who died of breast cancer when she was 5. Her father, Tony Ciccone, remarried three years later — which would prove a crucial point in Madonna’s wild-child development. She would later tell Interview magazine, “[My] rebellious attitude really came, I think, when my father remarried . . . I lost my mother, but then I was the mother, my father was [all] mine. Then he got taken away from me.”

Although she earned a dance scholarship to the University of Michigan, Madonna dropped out and moved to New York City in 1978 at the age of 19.

Throwing herself into the city’s nightlife — partying at Danceteria and the Roxy — Madonna made a notorious impression with her ripped fishnets and rosary beads. From the outside, she looked like the ultimate rebel, but it was all a carefully plotted image.

“The provocative persona she projects is incredibly controlled,” says O’Brien, “and the way she disciplines her kids is an extension of that. Her mother was an austere Catholic. That heavy-duty Catholicism is about being disciplined almost to the point of self-punishment.”

The singer feels she worked hard to get where she is today — and that her kids should do the same.

Madonna divulged her and Ritchie’s contrasting parental styles three years before they split, in a 2005 interview with Harpers & Queen. “I’m the disciplinarian, Guy’s the spoiler,” she said. “When Daddy gets home they’re going to get chocolate. I’m more practical.”

Rocco reportedly used to love being on tour, and danced with his mother onstage during her 2012 MDNA tour. But during the Rebel Heart tour, according to a source, they have had a series of screaming matches. Madonna hinted at the disconnect last August to Entertainment Weekly: “My 14-year-old son is absolutely not satisfied with all my accomplishments,” she confessed. “He just wants me to cook for him.”

There have also been reports that Rocco is fed up with Madonna’s oversharing on social media. She has posted videos of him performing a backflip wearing orange underwear with the caption, “Rocco’s preferred profile #nosausage,” and compared his long hair to that of Jeff Spicoli, the stoner played by her first husband, Sean Penn, in the movie “Fast Times at Ridgemont High.”

Meanwhile, Ritchie has long enjoyed a tight bond with his son. According to a source who attended Kabbalah meetings with the family while they were living in London, “Rocco would sit with his father, while Madonna would come in late wearing trucker hats and sunglasses and sit on her own. He would hang off his dad.”

To a fault, in the eyes of Madonna. A source adds she was unimpressed when she found out that Ritchie had cropped their adopted son, David Banda — along with Ritchie’s wife, Jacqui — out of an Instagram shot at the New York premiere of his “The Man From U.N.C.LE.”

“That Guy would publicly do that reinforced Madonna’s suspicion he was more devoted to his biological son than to his adopted son, which was a significant cause of their [2008] breakup,” says the source.

Lourdes has a far stronger relationship with her mother, but still gives Madonna issues. She’s acquired a reputation for being a party animal at her mother’s alma mater, the University of Michigan, where the teen is studying performing arts.

“Lourdes definitely takes after her mother in many ways,” a Madonna source reveals. “She has a magnet[ic] personality . . . She likes to let her hair down and party.”

She was photographed throwing back a Bud Light while attending her mom’s gig in Detroit last October, even though she was more than two years below the legal drinking age. Lourdes has also stubbornly resisted her mother’s entreaties to give up smoking.

Madonna, who said she was “devastated” when her eldest child left for college, is aware that laying down the law is losing its power. Says the Madge insider, “She has found out that with her teenagers, they can easily look online and see what she got up to at their age.”

Says Matthew Rettenmund, author of the Madge anthology “Encyclopedia Madonnica 20”: “Lourdes isn’t as immersed in Madonna’s touring as Rocco. She draws the line at keeping her own space and sanity. Rocco is in the process of figuring out how to do that.”

The Madonna source adds that Rocco misses his older half-sister. “She was the only one who really understood what he was going through — David and Mercy are still so young, they can’t connect with him on that level. Lourdes has been relishing her freedom and Rocco [is] envious in many ways.”

Rebelling as a quest for freedom runs in the family.

When Madonna was married to Ritchie (the two wed in 2000), Rettenmund says, “she was trying the buttoned-down good-wife approach.” But that persona soon wore off. “Toward the end of their marriage, they would throw dinner parties, but often go a whole night without talking to one another across the table,” adds a Ritchie source.

“Guy stood up to Madonna, which initially she found refreshing, but ultimately she got fed up of hearing how he would snigger to his friends about her hideous taste.”

For now, her son seems to have inherited this contempt. Rocco is expected to return to New York imminently, and TMZ has reported that Madonna plans to enroll him in a military school. But a friend of Ritchie’s says, “Guy is adamant Rocco should be free to choose to live where he wants to,” adding that the director has more time on his hands, now that the release date of his “Knights of the Roundtable: King Arthur” film has switched to Feb. 17, 2017, from next summer.

“The fact he can spend longer on the movie means he will have more time to confront Madonna over Rocco’s future,” says a source. “He’s ready for the fight.”

Additional reporting by Louisa Pisani