The study examined the relationship between gut microbiota composition and primary ventricular arrhythmias in 33 patients with ST-elevation myocardial infarction, of which 7 had ventricular arrhythmias. Using machine learning and analysis of stool samples in the acute phase (up to 7 days) and recovery phase (30-60 days), five bacterial taxa associated with arrhythmias were identified. The machine learning model achieved 85.7% sensitivity and 76.9% specificity. Analysis revealed increased abundance of certain bacterial species and enhanced activity of metabolic pathways related to fucose and purine degradation. The results suggest that a specific microbiota profile and its metabolic products may be associated with the occurrence of ventricular arrhythmias in myocardial infarction.