Mark Zuckerberg’s Facebook is facing off with Tim Cook’s Apple over posh Manhattan office digs slated to open next year inside a grandiose former post office, The Post has learned.

As The Post exclusively reported in September, Zuckerberg’s social media company has been in talks to take over all 740,000 square feet of office space being built in the former James A. Farley Post Office — a stately all-white structure located across from Madison Square Garden.

Only Apple, which toured the Farley renovation earlier this year, has suddenly decided it, too, wants all four floors of Farley’s office space being developed by Vornado Realty Trust — including a new floor being built on the roof that will be surrounded by gardens, sources said.

Applications by the dueling tech giants has posed a dilemma for Vornado’s street-savvy chairman, Steve Roth, who is also Facebook’s landlord at 770 Broadway, where the tech giant leases 758,000 square feet. As one source with knowledge of the dilemma explained, Apple — which carries a $1.069 trillion market capitalization, or more than double that of Facebook — “has better credit.”

Despite Apple’s girth, industry sources say Roth appears to be leaning toward Facebook, who he has worked with at the 770 Broadway location since 2013.

Apple also has feelers out at another Manhattan post office redevelopment project, known as Morgan North, in case Farley falls through, sources said.

The companies did not immediately return requests for comment but have stated in the past they won’t discuss ongoing negotiations for office space.

As The Post previously reported, Facebook’s interest in Farley derailed Japanese advertising firm Dentsu from its play to take over the fourth floor of the newly renovated Farley post office, which was built in 1912 along with the original Pennsylvania Station. Dentsu is now negotiating with developer Tishman Speyer for office space at Morgan North, bounded between Eighth and Ninth avenues and between 29th and 30th streets, sources said.

Amazon, Vornado’s tenant at 7 West 34th St., was also in the mix as it had also been discussing leasing 100,000 square feet at Farley with access to loading docks for a distribution facility it has been seeking near the West Side Highway.

After Facebook entered the picture, Amazon also turned to the Morgan redevelopment, which is slated to open in 2021, sources said.

If Apple gets bumped from Farley, it will likely trump the other companies also shopping for space there.

“It changes every week,” griped one broker. “Negotiations with tech companies are a slog and just take a long time,” said another source.

The Farley building, which occupies an entire city block at 390 Ninth Ave. between West 30th and 33rd streets, was designated a New York City landmark in 1966. The renovation will result in a new train hall under the building and restaurants and shops on the ground floor and lower levels.