The Kondo problem of a magnetic impurity embedded in the Lieb lattice is studied by the numerical renormalization group. The magnetic impurity hybridizes with conduction electrons from both the flat- and the soft-gap bands. We find a competition between the soft gap and the molecular Kondo singlet formations. The molecular Kondo effect occurs only when the magnetic impurity strongly hybridizes with conduction electrons at edge center sites of the Lieb lattice, and at the temperature range between the artificial strong coupling and the local moment regimes.