They are one of the most famous couples on Earth, yet intensely private — rarely allowing a glimpse of anything but the picture of a marriage and partnership that is constantly, blissfully happy. But a source who has been close to Beyoncé and Jay Z for years tells The Post that all is not well — and hasn’t been for quite some time. This is the first peek behind the firewall that is Beyoncé and Jay Z Inc. — what drew them together, why they’re headed for a split and why love was never the thing that held them together.

It was a master stroke of marketing: She gave him class, he gave her cred.

“There’s still something there, even though it’s not going to last,” says the source. “Business is always part of the equation. They know they’re the king and queen of hip-hop — and really, all of music. Neither wants to lose that.” Their current “On the Run” tour is predicted to gross $100 million, according to Forbes — which also ranked Beyoncé the world’s most powerful celebrity of 2014, with Jay Z ranked sixth. Billboard ranked the couple No. 1 on their February 2014 Power 100 list. Their combined net worth, according the International Business Times, is nearly $1 billion

But in the weeks since Beyoncé’s sister Solange was caught attacking Jay Z in a hotel elevator after the Met Gala, the couple’s tightly controlled image has been crumbling. And while they’ve been pushing back, kissing on stage and playing happy family on Instagram, the source says Jay and Bey are permanently broken, and that both are at fault. “Knowing them as I do, obviously there’s a little something to certain rumors,” the source says. “When your man or your woman isn’t getting it done for you, and I’m talking emotionally, not necessarily sexually … they keep things quiet.” Not for much longer.

‘They’re the only sharks’

When Jay Z and Beyoncé first got together in 1999, she was a star but a sheltered one. At 19, she still lived with her parents in Houston — dad Matthew, who quit his job at Xerox to manage her career with Destiny’s Child, and mom Tina, who became the group’s stylist. She hinted at being a virgin, and it’s reported that she left school at 14. Jay Z, then 30, had emerged from the Brooklyn projects as a hip-hop powerhouse. Having released his critically acclaimed debut “Reasonable Doubt” in 1996, he had a breakthrough commercial smash with 1998’s “Vol. 2 … Hard Knock Life.” A year later, Jay Z was arrested for allegedly stabbing producer Lance “Un” Rivera in a dispute over bootlegging; Jay pleaded guilty to a misdemeanor and walked away with three years’ probation. Jay Z and Beyoncé have always been circumspect about the beginnings of their romance, even as they stoked intrigue with their collaborations.

After breaking with Destiny’s Child, Beyoncé’s next project was a duet with Jay on his “’03 Bonnie and Clyde,” and in the video, they played a hip-hop version of the outlaw couple. When Beyoncé released her first solo album, 2003’s “Dangerously in Love,” Jay appeared on two tracks — including the first single and video for “Crazy in Love.”

It was a master stroke of marketing: She gave him class, he gave her cred. Jay Z was infatuated with Beyoncé, says the source, but the bottom line was business; he knew he could do big things for her, and together they could be a juggernaut. For Beyoncé, however, it was a slower burn. According to an interview with the website Celebuzz, her uncle Larry Beyince said that initially his niece had no interest. “He was after her and she wasn’t,” Beyince said. “She told me she wasn’t too fond of him … I guess she wasn’t attracted to him.”

The source says Beyoncé was most interested in Jay’s mind. “Jay’s a kingmaker; she recognized that. This was a come-up for her, no question. She had to learn the ropes as presented by Jay — but really, this was mostly about business.” As for dating others, he says, “they each had guilty pleasures.” The source believes that, along the way, she did really fall for Jay Z, and her parents, who had groomed Beyoncé to be a star from a very young age, were fine with it — for a time. But Matthew Knowles — who was described by former Destiny’s Child member LaTavia Roberson as “a drill sergeant” who made the girls work hours a day, seven days a week — slowly found himself edged out of his daughter’s life and career by Jay Z. Beyoncé had gone from one man to another, never truly being on her own.

“There’s no bigger controller than Jay,” the source says. “She’s great, but she’d be a little lower on the totem pole if it weren’t for hooking up with him.” In terms of ambition, talent, business acumen and work ethic, Beyoncé and Jay Z were perfectly matched. “They are solid, solid business people who know what they’re doing,” says the source, with Jay the mastermind. Their image, joint and separate, is based on exclusivity and unavailability; everything from the drop date of an album (2013’s “Beyoncé,” with its surprise one-day onslaught of 14 tracks and 17 videos) to a baby (Blue Ivy, born on a cleared-out hospital floor in NYC) is shrouded in mystery. Instead of interviews, they post to Instagram or drop clues in their lyrics. Beyoncé herself has spent every single day since 2005 being trailed by her own personal camera crew, which documents each waking moment of her life.

In 2013, Beyoncé told GQ magazine that she stores the footage in a climate-controlled warehouse based on the NBC library. “I now know that yes, I am powerful,” she told GQ. “I’m more powerful than my mind can even digest and understand.” “They don’t subscribe to that ‘teach-a-person-to-fish’ thing,” says the source. “They’ll give you a fish once in a while, but they let everyone know that they’re the only sharks in the water. Jay hangs with some of the crew from [his company] Roc Nation, but he’s doing bigger things than even they can keep up with. And Beyoncé only really gives her sister Solange and [ex-Destiny’s Child members] Kelly Rowland and Michelle Williams any real love. But even they can’t swing by without first getting clearance.” And it can be hard to stay in touch — Beyoncé and Jay Z both change their cellphone numbers every two weeks. Even other celebrities aren’t immune to quality control. It’s not whom they hang out with, says the source — “it’s who hangs out with them.” According to the source, they shunned Kanye West and Kim Kardashian’s wedding because it was too low-rent for the Jay Z/Beyoncé brand. “They are guarding like hell their status,” the source says. “Beyoncé wasn’t going to allow a Kardashian to socially climb her. And Jay didn’t want Kanye with Kim — he thinks it’s bad for business. I think Jay lost a little respect for Kanye there.”

‘Business first’

Over the past few months, says the source, Beyoncé has been losing respect for Jay Z and, ever on-brand, she’s been dropping hints. While performing “Resentment” during the couple’s June 28 show in Cincinnati, Beyoncé changed the lyrics from “Been ridin’ with you for six years” to “Been ridin’ with you for 12 years.” That would reference the year they became a couple.

“Solange was like, ‘Enough is enough — you must be [screwing] Rihanna.’ - Solange, according to source

And after the lyric “I gotta look at her in her eyes and see she’s had half of me,” Beyoncé tacked on the lines, “She ain’t even half of me/That bitch will never be.” Recent photos show that the “IV” tattooed on her ring finger — for her birthday, Jay’s birthday, and their wedding date — has been erased.

The source says the elevator fight after the Met Ball was really over Jay’s protégé Rihanna, whom he allegedly planned to meet later that night at his 40/40 club. “Solange was like, ‘Enough is enough — you must be [screwing] Rihanna,’” says the source. “To many people who know them, they know it’s not out of the realm of possibility.”

Today, the source says, it’s not whether they’ll split, but how they’ll split — adding that the only time Jay and Beyoncé are really together is on stage. They’re allegedly traveling with marriage counselors, but Jay — as he’s always done — spends much of his time on the phone, tending to business. “His phone’s constantly ringing,” says the source, “Jay trying to make deal after deal.” Calls to representatives for the couple by The Post were not returned.

The question now is whether to stay married while essentially living separate lives — becoming the Bill and Hillary of hip-hop — or publicly divorce. Ultimately, it will be about the brand. “There’s face-saving involved — they don’t want to be looked at like other celebrities out there,” says the source. “They are business people first, entertainers second. Husband and wife comes somewhere down the line.”