This crook really takes the cake.

A deliveryman stole nearly $90,000 worth of handmade cakes from a boutique Big Apple bakery touted by the likes of Martha Stewart and Oprah, a lawsuit alleges.

David Lliviganay, 32, is accused of swiping 1,020 pricey pastries — which retail for up to $90 apiece — from his employer Lady M Confections’ Long Island City warehouse in the span of just four months.

Lliviganay, who worked at the shop for two years, was caught on camera almost two dozen times going into the warehouse freezers empty-handed — and then sneaking out laden with up to eight black bags at a time believed to be packed with cakes, according to the suit filed in Queens civil court.

He then loaded the luxury cakes into a shipping cart and discreetly wheeled them to his waiting Dodge truck, court papers charge.

Lady M only learned someone was stealing its cakes when it was told unauthorized dealers were selling them on the cheap, according to the lawsuit filed last Tuesday.

It sparked a “thorough and exhaustive investigation” that caught Lliviganay on surveillance footage, with Wi-Fi log-in records also placing him at the scene of all the crimes, the lawsuit claims.

Lady M eventually found he’d been stealing regularly from November 2018 to February this year, with 357 cakes worth a total of $31,238 swiped in January alone, court papers allege.

As police started investigating, Lliviganay told his bosses he was going on vacation on Valentine’s Day — and never came back. He was formally fired a month later, the suit says.

He has pleaded guilty to petit larceny and will be sentenced at Queens Criminal Court on Sept. 24.

However, his sister, Daisy Lliviganay — who lives with him in Washington Heights — insisted to The Post that “they just made something up and charged him for it.”

In its suit, Lady M, which has six Manhattan stores, said it wants the full value of what he took “plus interest,” as well as punitive damages for his “intentional, malicious” and “outrageous” behavior.

One staffer told The Post on Sunday that the company made “a big mistake,” because Lliviganay was able to exploit “mismanagement” of the inventory system.

“They should have been doing their inventory,” the staffer said. “You can’t leave anything unaccounted for. Who does that?”

The worker said they’ve now beefed up security.

“Now, every night the bakers walk around doing inventory of all the cakes,” the staffer said.

Company owner Ken Romaniszyn declined to discuss the case.

“We put our customers first in all matters, and are dedicated to the quality of our cakes and service,” he said in a statement. “We also enforce company standards, which include honesty and integrity.”

Lliviganay didn’t return a call seeking comment.

The cake company was featured in O, The Oprah Magazine in May as a favorite for Mother’s Day gifts. Martha Stewart stopped by the Midtown location on her show.

Additional reporting by Lee Brown