All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His Slave and Messenger.
Insulting a Muslim is evildoing, as established by the Sunnah (Prophetic tradition). The Prophet, sallallaahu ‘alayhi wa sallam, said: "Insulting a Muslim is Fusooq (evildoing/disobedience)." [Al-Bukhari and Muslim] The sin of this insulter aggravates when he insults scholars of the Sunnah. Allaah The Almighty praised scholars and showed their excellence. Allaah The Almighty Says (what means):
• {Only those fear Allaah, from among His servants, who have knowledge.} [Quran 35:28]
• {Say, "Are those who know equal to those who do not know?"} [Quran 39:9]
It was narrated on the authority of Abu Umaamah that the Prophet, sallallaahu ‘alayhi wa sallam, said: "The virtue of the knowledgeable over the devout worshipper is like my virtue over the most inferior amongst you (in performing good deeds)." [At-Tirmithi and Ibn Maajah]
Consequently, you must not keep silent concerning this heinous evil that the Imaam of the Masjid commits; try to change it as much as you can. It was narrated on the authority of Abu Sa’eed that the Prophet, sallallaahu ‘alayhi wa sallam, said: "Whoever amongst you sees an evil, he must change it with his hand; if he is unable to do so, then with his tongue; and if he is unable to do so, then (he should abhore it) with his heart; and that is the least of faith." [Muslim, Ahmad, At-Tirmithi, Abu Daawood, Ibn Maajah, and An-Nasaa’i]
If you cannot change this evil at all, you should quit your work in this mosque and look for another place because performing prayer behind a dissolute Imaam is disliked, and some scholars considered the prayer invalid. Furthermore, a Muslim who quits anything for the sake of Allaah, Allaah The Almighty will surely compensate him with something better. However, if you could not find a chance to work in any other place, staying in the same place with him is permissible and you should abhor his evil acts in your heart.
Allaah Knows best.