Abstract Background Parvovirus B19 (B19V) is the most common type of virus found in endomyocardial biopsies (EMB) from patients with inflammatory heart disease. However, the detection of genomic B19V-DNA appears to have little clinical significance and is often considered an incidental finding. Recent analyses of a large cohort of B19V-positive patients revealed that the detection of RNA transcripts rather than DNA is of clinical importance, as B19V-RNA-positive patients have a significantly worse cardiovascular outcome. Here, we applied machine learning (ML) methods to assess the impact of B19V transcriptional activity on cardiac inflammation and patient clinical outcome. Methods and results A total of 305 patients with a known clinical course and a positive endomyocardial B19V-DNA test were included in this study. Follow-up measurements of the B19V-specific transcripts VP1/2 and NS1 revealed significantly worse clinical courses than in patients without B19V-RNA detection (P=0.019, hazard ratio (95% CI)=1.62 (1.10-2.57)). LVEF at follow-up was significantly lower in patients with detected B19V-RNA (P=0.007), and adverse events such as worsening LV function (P=0.003) or stable systolic dysfunction (P=0.013) were more frequent in this group. Importantly, analysis of inflammatory markers in EMB showed no difference in patients with and without RNA detection (P=0.432), suggesting that the deterioration in clinical outcome was related to B19V transcriptional activity rather than an increase in inflammation. The analysis of area under the receiver operating characteristic curve (AUROC) of B19V-RNA-negative patients revealed that the macrophage marker MAC-1 (AUROC=0.66, P=0.002) was the single most prognostically relevant parameter, while the T cell marker CD3 (AUROC=0.73, P<0.001) was identified as the most prognostically relevant marker in B19V-RNA-positive patients. The linear combination of several inflammatory markers increased the AUROC value to 0.67 in B19V-RNA-negative patients and to 0.74 in B19V-RNA-positive patients. To further increase prognostic accuracy, we trained ML models on features derived from EMB inflammatory markers. For the prediction of major adverse cardiac events within 60 months, the best ML-models achieved an AUROC of 0.87 in B19V-RNA-positive and of 0.86 in B19V-RNA-negative patients, while models that neglect the differentiation of patients with regard to the presence of B19V RNA transcripts only achieved an AUROC of up to 0.76. Conclusions These results show that B19V transcriptional activity is an independent risk marker for adverse cardiac events in patients with viral cardiomyopathy and thus confirm the clinical-therapeutic importance of myocardial biopsy. Furthermore, we present an ML-based algorithm that accurately indicates disease progression in B19V-positive cardiomyopathy patients and is thus helpful for appropriate therapy recommendation.