Sorry, Flywheel — your tax loophole won’t fly in the Big Apple.

The celebrity-friendly indoor cycling studio has lost a bid to skip paying city sales taxes through a state exemption for “participatory sporting activities.”

Gyms, Pilates studios and other similar establishments have to cough up the 4¹/₂ percent levy, but facilities providing basketball, racquetball or volleyball don’t.

The exemption applies only to athletic facilities, not fitness classes where the primary purpose of the activity is for health or weight loss.

Flywheel Sports, a national chain with 10 New York City locations, was started by one of rival SoulCycle’s founders, Ruth Zuckerman, in 2010. The 45-minute high-intensity spin classes cost $36. Flywheel’s A-list adherents include Sting, Ivanka Trump and Jimmy Fallon.

The chain was audited in 2015 by the state Department of Taxation, which ruled that the cycling sessions “didn’t rise to the level of a participatory sport” and that the company would have to pay the tax.

Instead, the chain sued in 2016, huffing that the agency reached the tax determination “without observing a single Flywheel Sports cycling session.”

“Cycling sessions are competitive activities,” the suit said, touting the Flywheel motto, “Fly, Compete. Repeat.”

“Although plaintiff’s members ride stationary bicycles, the cycling sessions are competitive events because riders are able to compare their results to other riders through a digital display,” the suit said.

“As such, the riders are racing against each other, despite being on stationary bicycles. Riders are also able to qualify for prizes from plaintiff, based on their results,” according to court papers.

The “illegal tax” would put Flywheel at a competitive disadvantage with “non-taxable participant sporting facilities,” the suit said.

But Manhattan Supreme Court Justice Robert Reed didn’t buy it.

“This is unpersuasive,” he wrote in a short, two-page ruling.

Lawyers for Flywheel and a spokesman for the Department of Taxation did not return messages seeking comment.