I've heard from multiple Rabbanim that it is a mitzvah to make fun of Avodah Zarah. I have been performing this mitzvah with pleasure for many years and I would like to know the source for it.
I'm quite surprised that in my below research, I did not see any references to the Gemara in Avodah Zarah 45b-46a (edit: I saw it mentioned as an aside in one source), which not only implies that it is a mitzvah to make fun of Avodah Zarah, it even provides sources! Here it is, with the Davidson Edition translation:
ורבנן ההוא לכנות לה שם דתניא ר"א אומר מנין לעוקר עבודת כוכבים שצריך לשרש אחריה ת"ל ואבדתם את שמם
The Gemara asks: And what do the Rabbis derive from this verse? The Gemara answers: That verse teaches that it is a mitzva to give a derogatory nickname to an idol. As it is taught in a baraita that Rabbi Eliezer says: From where is it derived that when one deracinates an object of idol worship, he needs to root out all traces of it? The verse states: “And you shall destroy their name out of that place.”
אמר לו ר"ע והלא כבר נאמר (דברים יב, ב) אבד תאבדון אם כן מה ת"ל ואבדתם את שמם מן המקום ההוא לכנות לה שם
Rabbi Akiva said to him: But isn’t it already stated: “You shall destroy” (Deuteronomy 12:2)? This obviously includes rooting out all traces of idols. If so, what is the meaning when the verse states: “And you shall destroy their name out of that place”? This means that it is a mitzva to give it a nickname.
יכול לשבח לשבח ס"ד אלא יכול לא לשבח ולא לגנאי ת"ל (דברים ז, כו) שקץ תשקצנו ותעב תתעבנו כי חרם הוא
One might have thought that one may give it a positive nickname. The Gemara interjects: Would it enter your mind that one may give a positive nickname to an idol? Rather, the baraita means that one might have thought that the reference is to a nickname that is neither positive nor negative. Therefore, the verse states: “And you shall not bring an abomination into your house, and be accursed like it; you shall detest it, and you shall abhor it; for it is a proscribed item” (Deuteronomy 7:26). This verse clearly indicates that the nickname should be a negative one.
הא כיצד היו קורין אותה בית גליא קורין אותה בית כריא עין כל עין קוץ
How so? To what type of nickname is this referring? If the idol worshippers would call their house of worship the house of elevation [beit galya], one should call it the house of digging [beit karya]. If they call it the all-seeing eye [ein kol], one should call it the eye of a thorn [ein kotz].
This article cites the Minchas Elazar Telisa'ah 52 (I could not find this on Bar Ilan) as making the same comment - based on the Gemara, there is no indication that there is a Mitzvah to do so!
However, the same Minchas Elazar is cited in Daf Al Hadaf to Megillah 25b, and it says that the conclusion must be that if the Nevi'im said this, there must have been a Mitzvah to do so, not simply permission, (and this is probably why so many people upvoted the answer, since it is intuitive).
Another excellent point is the citation of Orchos Tzaddikim which notes that this will help deter people from worshiping Avodah Zarah, and therefore would be a mitzvah.
However, the article (and others) note another possible halachic source for this entire discussion:
Shulchan Aruch Choshen Mishpat 8:1 writes (Denburg translation, see notes there):
וכל דיין המתמנה בשביל כסף או זהב אסור לעמוד לפניו ולא עוד אלא שמצוה להקל ולזלזל בו
And every Judge who gets appointed on account of silver or gold, — [the law is that] it is forbidden to rise before him; and what is more, it is a religious duty to treat him with disrespect and to despise him
Why is it a mitzvah to mock such a person?
ר' מנא מיקל לאילין דמתמניי בכסף. רבי אימי קרא עליהון [שמות כ כ] אלהי כסף ואלהי זהב לא תעשו לכם
R. Mani spoke with disrespect of those that get appointed to office for money. R. Imi would apply to them the Scriptural verse, gods of silver, or gods of gold, ye shall not make unto you (Ex. XX, 20)
They conclude from this that it is a Mitzvah to make fun of these judges, just as it is a Mitzvah to make fun of Avodah Zarah. In the words of the Sema (liked above, although for some reason the Sefaria transcription writes אלקי instead of אלהי):
שהכתוב קראן אלהי כסף ואלהי זהב כמו שכתב אלהי כסף ואלהי זהב לא תעשו לכם ודרשי' אלהי' הנעשה בשביל כסף ודומיא דעובדי כוכבי' דמצוה לזלזל בהו:
For the verse called them "gods of silver and gods of gold", as it is written "gods of silver and gods of gold you shall not make for yourselves", and we expound "judges [elohim] who are appointed/created for money", and they are similar to avodah zarah, which it is a mitzvah to mock.
Based on the formulation of the Urim noted above, it is clear that he understood the mitzvah of mocking idols/idol worshipers as emergent from the Gemara in Megillah quoted by Daniel above, since he cites that as proof (although to be fair he says it is fitting, and doesn't say that it is a mitzvah, but many others do):
והרי הוא כע"ז דראוי לנהוג בו בזיון וכל ליצנות' אסירי כו':
...And he is like an avodah zarah which is fitting to act with disgrace "and all mockery is forbidden..." (Megillah 25b)
For a source which understands the Gemara in Megillah directly this way, see here.
Also, the article cites the Arizal in his Siddur (I couldn't find this either) who notes that just as it is a big aveirah to mock non-evil people, it will be a big mitzvah to mock avodah zarah and evil people.
To be fair, by the way, the source of the Shulchan Aruch is the Rambam (Sanhedrin 3:9), who writes that this is a commandment of the Rabbis, and I'm not sure that his source was really in the Yerushalmi (Sefaria translation):
כָּל דַּיָּן שֶׁנָּתַן מָמוֹן כְּדֵי שֶׁיִּתְמַנֶּה אָסוּר לַעֲמֹד מִפָּנָיו. וְצִוּוּ חֲכָמִים לְהָקֵל אוֹתוֹ וּלְזַלְזֵל בּוֹ. וְאָמְרוּ חֲכָמִים שֶׁהַטַּלִּית שֶׁמִּתְעַטֵּף בָּהּ תְּהִי בְּעֵינֶיךָ כְּמִרְדַּעַת שֶׁל חֲמוֹר:
It is forbidden to rise before a judge who has paid money to be appointed. The sages tell us to look upon him with utter contempt.
And no, I'm not going to continue to discuss if this Mitzvah is De'oraisa or Derabanan, this is long enough as is...
מר רב נחמן כל ליצנותא אסירא בר מליצנותא דעבודת כוכבים דשריא דכתיב (ישעיהו מו, א) כרע בל קרס נבו וכתיב (ישעיהו מו, ב) קרסו כרעו יחדיו לא יכלו מלט משא וגו' ר' ינאי אמר מהכא (הושע י, ה) לעגלות בית און יגורו שכן שומרון כי אבל עליו עמו וכמריו עליו יגילו על כבודו כי גלה ממנו אל תקרי כבודו אלא כבידו
Similarly, Rav Naḥman said: All mockery and obscenity is forbidden except for mockery of idol worship, which is permitted, as it is written: “Bel bows down, Nevo stoops” (Isaiah 46:1). The prophet mocks these idols by describing them as crouching in order to defecate. Additionally, it is written: “They stoop, they bow down together; they could not deliver the burden” (Isaiah 46:2). Rabbi Yannai said: This principle that one is permitted to mock idol worship is derived from here: “The inhabitants of Samaria shall be in dread for the calves of Beth-aven; for its people shall mourn over it, and its priests shall tremble for it, for its glory, because it is departed from it” (Hosea 10:5). Do not read it is as “its glory [kevodo],” rather read it as its burden [keveido], meaning that it is unable to restrain itself from defecating.
אמר רב הונא בר מנוח משמיה דרב אחא בריה דרב איקא שרי ליה לבר ישראל למימר ליה לעובד כוכבים שקליה לעבודת כוכבים ואנחיה בשין תיו שלו אמר רב אשי האי מאן דסנאי שומעניה שרי ליה לבזוייה בגימ"ל ושי"ן האי מאן דשפיר שומעניה שרי לשבוחיה ומאן דשבחיה ינוחו לו ברכות על ראשו:
Rav Huna bar Manoaḥ said in the name of Rav Aḥa, son of Rav Ika: It is permitted for a Jew to say to a gentile: Take your idol and put it in your shin tav, i.e., shet, buttocks. Rav Ashi said: One whose reputation is tarnished, i.e., he is known as a philanderer, it is permitted to humiliate him by calling him gimmel sin, an acronym for girta sarya, son of a putrid harlot. One whose reputation is commendable, it is permitted to publicly praise him, and one who praises him, blessings will rest upon his head.