Résumé : Many shear flows exhibit laminar to turbulent transitions at subcritical Reynolds numbers. In this context, the computation of the perturbations that exhibit the largest possible transient growth is of central interest as it often sheds light on the actual bypass transition route. In this work, we consider the effect on the transient growth of a spanwise magnetic field in a boundary layer flow of a liquid metal over an electrically insulating flat plate. We compute the optimal perturbations using non-modal theory and perform a parametric study to measure the influence of the magnetic field on their amplification and orientation with respect to the flow direction. We also perform direct numerical simulations to examine how the optimal perturbations evolve in the nonlinear regime. To assess the influence of the boundary layer development, we consider both a constant Blasius base flow profile and a growing base profile. We show that the properties of the optimal perturbations are not significantly affected by the choice of the base profile, whereas it has a more important impact on their evolution in the nonlinear regime.