I think your answer may differ depending on whether you are dealing with a narcissist or a psychopath. Psychopathy is a kind of learning disorder, where the afflicted can't really learn from their mistakes. That's why most prisons make inmates take the HARE TEST before allowing them to go on parole. High scores mean the inmate is a psychopath, and is extremely likely to re-offend. So no, I don't think psychopaths know how stupid they are, they are more likely to blame people around them when things go wrong.
Should you be dealing with a Narcissist, it is a little different. Narcissist have trouble learning from their mistakes, but they also live off something called Narcissistic Supply, which usually comes in the form of attention from others. This attention can be either negative or positive, as long as it is ongoing. If you are reacting to the "stupid" and "ridiculous" behavior of a Narcissist, you are invariantly also feeding into their Narcissistic Supply. Even being infamous or hated is satisfying on some level to an N, they usually though fits if their behavior is downplayed or ignored.