Effect of magnetic field on interfacial deformation of thermocapillary convection in a two-layer fluid system under microgravity condition is investigated. The upper layer fluid is silicon oil, the lower layer fluid is InBi. The dynamic conditions at free surface are implemented through the continuum surface force (CSF) model with the volume of fluid (VOF) method. The induction magnetic field method is used. The results show that, the interface bulges out at the hot end and bulges in at the cold end without magnetohydrodynamic (MHD) and the interface deformation is dominated by dynamic pressure. Under the influence of magnetic field, the interface deformability decreases with increasing of Hartmann number, and the interface deformation can be fully suppressed while the Hartmann number is enough large and the damping of magnetic field on the deformation of interface mainly concentrated at the region close to the interface.