Whichever way you slice it, this pizza pilferer’s plan was half-baked.

A Washington state man robbed a Pizza Hut delivery driver at gunpoint for his $81 grub order and he was later arrested — and publicly mocked by police — after cops were able to track him down because he placed the order from the same phone number he made another order from days earlier.

“Man, I made a stupid mistake,” the 20-year-old delinquent told Pierce County sheriff’s deputies as he admitted he called in the food order and “robbed the pizza girl” on Friday with another pal, whom he would not identify, police said.

The regretful crook went on to say he had “messed up his life over 80 bucks in pizza,” authorities said.

According to cops, the suspect had placed his food order for pizza, cookies and bread under the name “David Adams” to be delivered to an address in the city of University Place.

When the delivery driver arrived at 7 p.m., she called the “customer” and he told her to meet him in front of another building in the apartment complex.

At the meeting place, the victim was approached by two men — one who pressed a handgun against her leg and another who ordered her to hand over the food, cops said.

The bandits fled with their $81.24 order and the victim called police.

Responding officers then had Pizza Hut run the phone number used to place the order through its computer system and it was discovered that an order had been placed from that number four days earlier under a different name from an address in the same apartment complex where the theft occurred.

When cops went to that address, they heard loud music playing and smelled marijuana, police said, noting that when officers knocked and announced “Police!,” someone inside the apartment said “Don’t answer” and the music was turned off.

Cops then saw several people inside step out onto the third-floor balcony to possibly make a break for it, but they were ordered to stop.

As officers entered the apartment, they found five men and two women along with several Pizza Hut boxes containing half-eaten food that matched the order swiped during the heist — and a loaded Glock .40-caliber semi-automatic handgun.

The name of one of the men inside matched the name that placed the order days earlier.

The suspect who admitted to cops that he robbed the delivery driver also disclosed that he had recently stolen the gun he used in the stickup, police said.

Cops booked the man, whose identity was not released, to Pierce County Jail for robbery and assault in the first degree.

His pals who were inside the apartment denied any involvement in the robbery and several noted that when they arrived, the suspect was already there with the food.

The Pierce County Sheriff’s Department mocked the stupidity of the robbery on Facebook, writing: “If you are going to rob a pizza driver at gunpoint and you want to get arrested, you should: use your own phone to order the pizza, call from the same number you ordered a pizza from 4 days earlier, commit the crime in your apartment complex parking lot, use a gun you stole from someone at a party, be in possession of cell phone, gun, and pizza when we come knocking on your door.”