Abstract Hyperglycaemia, hyperlipidaemia, hypertension and obesity are the main risk factors affecting the development and prognosis of ischaemic heart disease, which is still an important cause of death today. In our study, male Sprague–Dawley rats were fed either a standard diet (SD) or a high fat and high carbohydrate diet (HF‐HCD) for 8 weeks and streptozotocin (STZ) was injected at the seventh week of the feeding period. In one set of rats, a mixture of a prebiotic and probiotics (synbiotic, SYN) was administered by gavage starting from the beginning of the feeding period. Experimental myocardial ischaemia–reperfusion (30 min/60 min) was induced at the end of 8 weeks. Hyperglycaemia, hypertension and increased serum low‐density lipoprotein levels occurred in SD‐ and HF‐HCD‐fed and STZ‐treated rats followed for 8 weeks. Increased density of the Proteobacteria phylum was observed in rats with increased blood glucose levels, indicating intestinal dysbiosis. The severity of cardiac damage was highest in the dysbiotic HF‐HCD‐fed hyperglycaemic rats, which was evident with increased serum creatine kinase‐MB (CK‐MB), cardiac troponin I (cTnI), tumour necrosis factor‐α, and interleukin‐6 levels, along with a decrease in ST‐segment resolution index. SYN supplementation to either a normal or a high‐fat high‐carbohydrate diet improved gut dysbiosis, reduced anxiety, decreased CK‐MB and cTnI levels, and alleviated myocardial ischaemia–reperfusion injury in hyperglycaemic rats.