Jon Stewart got into an epic argument with shock jock Anthony Cumia at New York’s famed Comedy Cellar, with the former “Daily Show” host calling Cumia a “f - - king piece of s - - t.”

Cumia, who was fired from SiriusXM in 2014 after a racist tirade, recounted the confrontation on his Compound Media show. “We look at each other, so I put my hand out and go, ‘Hey, Jon,’ and he goes, ‘I’m not shaking your hand, you f - - king piece of s - - t.’ Whoa, well, my reputation precedes me.”

Cumia asked what Stewart’s problem was, and the comic told him, “You talk a lot of s - - t about me.” Cumia responded that it was just comedy material, and added, “How long have you been in this business? . . . You don’t know how this works?”

Cumia, meanwhile, took offense at who Stewart is happy to shake hands with. “There are plenty of pictures of him shaking hands with [alleged] pedo Anthony Weiner,” he continued, ignoring the fact that Stewart and Weiner go back a long way and were even roommates years ago.

Cumia says things got so heated, with wild expletives flying, that Noam Dworman, owner of the joint, came over to calm things down. “So there were a lot of ‘f - - k yous’ and s - - t going back and forth at this point and Noam . . . is very nervous because Jon Stewart is one of the big stars who come in . . . and I’m like, ‘I’m not gonna hit him.’ ” Cumia was fired by Sirius in 2014 for ‘racially charged’ tweets and pleaded guilty in a domestic violence case in 2016.

Cumia claims Stewart finally reluctantly shook his hand and added, “I’m like, ‘Whatever, good night,’ that’s that, I go back to the bar and he goes to his table with his posse, Aziz Ansari and the little collection of beta males who are gonna discuss how they can help feminists.”

Cumia insists there were no punches thrown. “I don’t fight . . . I was laughing about it, because it was so dopey. Whatever. Jon Stewart is a f - - king a - - hole.” He added, “I don’t think he’s ever been a good stand-up.” While Stewart didn’t comment, Dworman is upset Cumia is blabbing. “He’s violating the place and the terms that he’s treated as a guest . . . I don’t remember any comedian ever running to the papers or their comedy show to discuss what happened to them.”