After many attempts I was able to find a solution for this problem. In my case I tried using two audio cards, one for the output and as a clock source and another one only for the inputs. Thus the problem disappeared. I leave details of my setup:
iMac 24 M1 8GB
Audio interface output and clock source: Scarlett Solo
Audio input interface: Behringer FCA 1616
Audio drops and glitches disappeared in both Ableton Live 10 and 11 and Logic Pro.
Hope it helps!