The invention relates to a dual-mode fluorescent/magnetic resonance imaging contrast agent based on mesoporous silica and a preparation method thereof. The preparation method comprises the following steps: dissolving CTAB, and adding NaOH; dropwise adding TEOS; stirring, aging, washing, drying and roasting; dispersing a product in a toluene solution, adding APTES, refluxing, washing, dispersing through water to obtain a solution a, adding a chelating agent in DMSO, dissolving, separately adding NHS and EDC, stirring, adding the solution a, adding a gadolinium salt, filtering, washing, and dispersing with water to obtain a solution b; adding fluorescent molecules containing carboxyl in another DMSO, separately adding NHS and EDC, stirring, adding the solution b, stirring, filtering, washing, drying to obtain the dual-mode fluorescent/magnetic resonance imaging contrast agent based on mesoporous silica. The difunctional contrast agent has the advantages of small particle size, stable performance, good biocompatibility and strong fluorescence and magnetic resonance signals.