Abstract In this numerical study, the entropy generation in double-diffusive natural convection in a square enclosure with the presence of adiabatic rectangular block at the center of the enclosure is examined. The uniform magnetic field is applied horizontally to the enclosure. The Lattice–Boltzmann approach is carried out to solve the governing equations. The linear increment of heat is applied to the left wall of the cavity. Both horizontal walls are an adiabatic condition, and the right wall is considered to be at cold temperature. The analysis is carried out for different range of operating parameters such as Rayleigh number (103 ≤ Ra ≤ 105), Lewis number (2 ≤ Le ≤ 10), buoyancy ratio (−2 ≤ N ≤ 2), Hartmann number (0 ≤ Ha ≤ 50) for the liquid metal sodium-potassium (NaK) alloy with Prandtl number (Pr) 0.054. Increasing Rayleigh number causes the entropy generation to expand, and increasing Ha decreases the total entropy generation for all Ra values. For the present problem, the critical N value is found to be −1.5. The rise of Le leads to the augmentation of irreversibility in the enclosure. The decrement of SF when compared with Ha = 0 and 50 is 97%, 91.5% and 75.64% for Ra = 103, 104, and 105, respectively.