In my experience, this is usually a slightly jokey response. A bit "tongue-in-cheek".
A: Did you tell them that my jokes are terrible?
B: As if I (ever) would.
Here the response implies that B thinks the jokes are bad and that A knows that. B is jokingly saying that they probably did say that, but they are being coy about it, perhaps a little bit sarcastic. B knows that it won't make A mad to know they said this.
The joke, or humour, is that although B is saying they would never say that, they both know that B did (or probably did) say it.