We study the RKKY interaction of magnetic impurities in the $\alpha-\mathcal{T}_3$ model which hosts pseudospin-1 fermions with two dispersive and one flat bands. By using the effective low-energy Hamiltonian we calculate the RKKY coupling for impurities placed on the same or different sublattices. We find that there are three types of interaction, which depend on the model parameter defining the relative strength of hoppings between sublattices, two of them can be reduced to graphene case while the third one is new and is due to the presence of a flat zero-energy band. We derive general analytical expressions for the RKKY interaction in terms of Mellin-Barnes type integrals and analyze different limiting cases. The cases of finite chemical potential and temperature, as well as asymptotic at large distances are considered. We show that the interaction between impurities located at different rim sites displays a very strong temperature dependence at small doping being a direct consequence of the flat band. The subtleties of the theorem for signs of the RKKY interaction at zero doping, as applied to the $\mathcal{T}_3$ lattice, related to the existence of a dispersionless flat band are discussed.