We present MUFFIT, a new generic code optimized to retrieve the main stellar population parameters of galaxies in photometric multi-filter surveys, and we check its reliability and feasibility with real galaxy data from the ALHAMBRA survey. Making use of an error-weighted $chi^2$-test, we compare the multi-filter fluxes of galaxies with the synthetic photometry of mixtures of two single stellar populations at different redshifts and extinctions, to provide through a Monte Carlo method the most likely range of stellar population parameters (mainly ages and metallicities), extinctions, redshifts, and stellar masses. To improve the diagnostic reliability, MUFFIT identifies and removes from the analysis those bands that are significantly affected by emission lines. We highlight that the retrieved age-metallicity locus for a sample of $z le 0.22$ early-type galaxies in ALHAMBRA at different stellar mass bins are in very good agreement with the ones from SDSS spectroscopic diagnostics. Moreover, a one-to-one comparison between the redshifts, ages, metallicities, and stellar masses derived spectroscopically for SDSS and by MUFFIT for ALHAMBRA reveals good qualitative agreements in all the parameters. In addition, and using as input the results from photometric-redshift codes, MUFFIT improves the photometric-redshift accuracy by $sim 10$-$20%$, and it also detects nebular emissions in galaxies, providing physical information about their strengths. Our results show the potential of multi-filter galaxy data to conduct reliable stellar population studies with the appropiate analysis techniques, as MUFFIT.