diff --git a/gajim/common/config.py b/gajim/common/config.py
index e9d590ebb8bbf4d4c20f13cdb6d2a90c98f74080..43bb1d2dc86c61af96ecb89b16a88886866712a9 100644
--- a/gajim/common/config.py
+++ b/gajim/common/config.py
@@ -305,6 +305,7 @@ class Config:
             'use_keyring': [opt_bool, True, _('If True, Gajim will use the Systems Keyring to store account passwords.')],
             'pgp_encoding': [ opt_str, '', _('Sets the encoding used by python-gnupg'), True],
             'remote_commands': [opt_bool, False, _('If True, Gajim will execute XEP-0146 Commands.')],
+            'mam_blacklist': [opt_str, '', _('All non-compliant MAM Groupchats')],
     }, {})
 
     __options_per_key = {
diff --git a/gajim/common/connection_handlers.py b/gajim/common/connection_handlers.py
index e561630d8329e5e4c230621bfc30365d65704a5d..e0835d514aba3aa8934d71a8db809d2e68e2cc17 100644
--- a/gajim/common/connection_handlers.py
+++ b/gajim/common/connection_handlers.py
@@ -1067,9 +1067,17 @@ class ConnectionHandlersBase:
                 conn=self, msg_obj=obj, stanza_id=obj.unique_id))
             return True
 
+    def _check_for_mam_compliance(self, room_jid, stanza_id):
+        namespace = muc_caps_cache.get_mam_namespace(room_jid)
+        if stanza_id is None and namespace == nbxmpp.NS_MAM_2:
+            helpers.add_to_mam_blacklist(room_jid)
+
     def _nec_gc_message_received(self, obj):
         if obj.conn.name != self.name:
             return
+
+        self._check_for_mam_compliance(obj.jid, obj.unique_id)
+
         if (app.config.should_log(obj.conn.name, obj.jid) and
                 obj.msgtxt and obj.nick):
             # if not obj.nick, it means message comes from room itself
diff --git a/gajim/common/helpers.py b/gajim/common/helpers.py
index a8d43a9a9d96855fcdd54ee37a2badce76330308..6a51590a905834e6b814f7f008b0a54220cbbcbc 100644
--- a/gajim/common/helpers.py
+++ b/gajim/common/helpers.py
@@ -1626,3 +1626,21 @@ def get_emoticon_theme_path(theme):
     emoticons_user_path = os.path.join(app.MY_EMOTS_PATH, theme)
     if os.path.exists(emoticons_user_path):
         return emoticons_user_path
+
+def add_to_mam_blacklist(jid):
+    config_value = app.config.get('mam_blacklist')
+    if not config_value:
+        config_value = [jid]
+    else:
+        if jid in config_value:
+            return
+        config_value = config_value.split(',')
+        config_value.append(jid)
+    log.warning('Found not-compliant MUC. %s added to MAM Blacklist', jid)
+    app.config.set('mam_blacklist', ','.join(config_value))
+
+def get_mam_blacklist():
+    config_value = app.config.get('mam_blacklist')
+    if not config_value:
+        return []
+    return config_value.split(',')
diff --git a/gajim/common/message_archiving.py b/gajim/common/message_archiving.py
index ec03bf94f594854f7be28fc4cb9c1b7d72cd3fd6..6301ac3fbe80d34263718048cb9444e8354c4ce6 100644
--- a/gajim/common/message_archiving.py
+++ b/gajim/common/message_archiving.py
@@ -25,6 +25,7 @@ import nbxmpp
 
 from gajim.common import app
 from gajim.common import ged
+from gajim.common import helpers
 from gajim.common.logger import KindConstant, JIDConstant
 from gajim.common.const import ArchiveState
 from gajim.common.caps_cache import muc_caps_cache
@@ -205,7 +206,8 @@ class ConnectionArchive313:
         if obj.groupchat:
             namespace = muc_caps_cache.get_mam_namespace(obj.room_jid)
 
-        if namespace != nbxmpp.NS_MAM_2:
+        blacklisted = obj.room_jid in helpers.get_mam_blacklist()
+        if namespace != nbxmpp.NS_MAM_2 or blacklisted:
             # Fallback duplicate search without stanza-id
             duplicate = app.logger.search_for_duplicate(
                 self.name, obj.with_, obj.timestamp, obj.msgtxt)