Multicomponent reactions of ammonium chloride in water with formaldehyde and SH‐acids (H2S, ethane‐1,2‐dithiol) proceed with selective formation of such heterocycles as 3,7‐dithia‐1,5‐diazabicyclo[3.3.1nonane, 3‐(1,5,3‐dithiazepan‐3‐ylmethyl)‐1,5,3‐dithiazepanе and 1,6‐bis‐(1,5,3‐dithiazepan‐3‐yl)‐2,5‐disulphanylhexane. With participation of 1,3‐propanedithiol, this reaction leads to the formation of three‐dimensional hetero(S,N)‐chain polymer. The antifungal activity of 3,7‐dithia‐1,5‐diazabicyclo[3.3.1]nonane against microscopic fungi Bipolaris sorokiniana, Fusarium oxysporum and Aspergillus niger and same for 1,6‐bis‐(1,5,3‐dithiazepan‐3‐yl)‐2,5‐disulphanylhexane against Botrytis cinerea and Rhizoctonia solani was evaluated.