The invention relates to a cosmetic composition comprising, in a cosmetically acceptable medium: (i) from 0.01% to 10% by weight, relative to the total weight of the composition, of one or more compounds chosen from ellagic acid, ethers thereof and ellagic acid salts or ethers thereof, in a content ranging (ii) one or more extracts of one or more non-photosynthetic, non-fruiting filamentous bacteria, and (iii) one or more surfactants chosen from anionic and/or amphoteric or zwitterionic surfactants. The invention also relates to a cosmetic treatment process using such a composition, and to the use of this composition for eliminating and/or reducing the amount of dandruff on the hair and the scalp.