Impurity-tuned non-equilibrium phase transition in a bacterial carpet