Generalized dynamic programming principle and sparse mean-field control problems