Facebook had a weird week.

The social media behemoth you love to hate posted some gaudy fourth-quarter earnings numbers on Wednesday. The report got a lot of likes on Wall Street. Some said it meant founder and CEO Mark Zuckerberg had finally turned the page on an otherwise terrible year.

Not so fast. Something else happened to Facebook last week that may say more about the company’s long-term health than any happy-dappy earnings statement.

The website TechCruch reported on Tuesday that Facebook has been paying users between the ages of 13 and 35 to install a VPN, or virtual private network, on their phones. The users get $20 a month; Facebook gets access to … well, everything.

The Facebook Research VPN app hoovered up all incoming and outgoing data. Not just Facebook data — all data, from web browsing to texting to activity on other apps. According to TechCruch, “Facebook went so far as to ask users to screenshot and submit their Amazon order history.”

So who has a problem with Facebook paying people to harvest their data?

Apple, that’s who.

The iPhone maker is a top dog in the platform game. And the company has rules developers must abide by if they want to use iOS or do business in the App Store. With its pay-to-play research app, Facebook broke those rules. The Cupertino boys weren’t happy.

Punishment was swift — Apple revoked Facebook’s access to its “enterprise developer” program, which enables companies to bypass the App Store when they want to build an application for internal corporate use. That spiked the VPN but also many of the apps that Facebook employees use to message each other and set up meetings. They even use them to order lunch, poor things.

Several outlets reported that Apple’s actions this week sparked two days of chaos at Facebook’s Menlo Park headquarters. Apparently, 6,000 high-paid, hoody-clad millennials can’t work at all if they can’t work online. (But if punishment was swift, so was mercy. Apple relented late Thursday and restored Facebook’s internal apps. Silicon Valley’s best and brightest could once again order up their bacon kimchi hot dogs and reserve seats on the corporate shuttle bus to Golden Gate Park.)

Based on everything we know, ignoring Apple’s house regs is entirely in character for Facebook. Zuckerberg has always assumed the rules only apply to other people. In his new book, “Zucked: The Education of an Unlikely Activist,” Roger McNamee writes that even at Harvard Zuckerberg “showed a persistent indifference to authority, rules and the users of his products.”

If you saw “The Social Network,” you know what Zuckerberg did to the Winklevoss twins. That was just the tip of the entitlement iceberg. In 2010 Business Insider unearthed instant messages in which the future bazillionaire called early Facebook users “dumb f–ks” for handing over their personal information.

Zuckerberg may be the richest person in his age bracket, but he may also be the most unpopular businessman in America.

Zuckerberg got dressed down by Congress last year over his company’s persistent lax attitude toward user privacy. It was the first sustained look most Americans got at the oddly robotic boy genius who knows everything about them. Few were impressed. Many were properly skeeved. Something seemed genuinely off about the guy. Almost like … he doesn’t get it.

Poll after poll shows Americans want their personal data to remain private and they don’t trust Young Zuck to do it. He may be the richest person in his age bracket, but he may also be the most unpopular businessman in America (who doesn’t live at 1600 Pennsylvania Ave.).

McNamee says Zuck’s knee-jerk response to criticism of any kind is this: “deny, delay, deflect, dissemble.” The two-faced phony apologies usually work. They didn’t work this week. My guess is they won’t work with the public much longer, either.

Unlike Congress, Apple actually has some juice. After a decade and a half of moving fast and breaking things, Zuckerberg and friends are finally getting a taste of their own medicine. In their unlimited hubris, they picked a fight with an outfit that couldn’t be bullied into submission.

It may seem crazy to say, especially when they’ve just posted a record quarterly profit, but I think Facebook is on the way out. The new users it’s adding are in parts of the world that spend less time and money on Facebook than do increasingly disaffected Westerners. Maybe Facebook can make up the lost revenue in volume, or maybe the rest of the world will get just as sick of being lied to as we have.

The “dumb f–ks” can only take so much.

Matthew Hennessey is the author of “Zero Hour for Gen X: How the Last Adult Generation Can Save America from Millennials” (Encounter), out now.