High intake of dietary fiber is associated with lower incidence of cardiovascular diseases. Dietary fiber, functions as a prebiotic, has a significant impact on intestinal bacteria composition and diversity. The intestinal flora and metabolites generated by fermentation of dietary fiber not only affect the health of intestine but also play a role in many extra-intestinal diseases, such as obesity, diabetes and atherosclerosis. However, the role and the mechanism by which a high fiber diet contributes to the development of myocardial infarction is still unclear. Here we used an in vivo mouse model to investigate whether dietary fiber intake could protect against myocardial infarction. Our study demonstrated high fiber diet significantly improved cardiac function, reduced infarct size and prevented adverse remodeling following myocardial infarction. The protective effects of high fiber diet had a strong relation with its attenuation of inflammation. Moreover, we observed that high fiber diet could modulate the composition of intestinal flora and differentially impacted metabolites production, including the biosynthesis of bile acids and linoleic acid metabolism. Overall, the findings of this study provided mechanistic insights into the curative effect of dietary fiber on myocardial infarction with a specific emphasis on the potential role of microbiota-metabolism-immunity interactions.