Background: Accurate coding of complex patients is essential for care systems to remain viable in a value-based payment world that includes risk-adjustment. The objective of this study was to determine if use of the Wizard© clinical decision support (CDS) system that improves quality of care for patients with uncontrolled cardiovascular risk increases appropriate diagnostic coding of cardiometabolic conditions at primary care visits. Methods: We conducted a clinic randomized trial of a web-based CDS system at 17 primary care clinics in Minnesota from March 15, 2017, to December 31, 2017. The CDS system a) identified adults at primary care encounters with high reversible cardiovascular risk, and prompted nurses to print Wizard handouts and give them to patients and providers immediately antecedent to the visit; b) provided prioritized evidence-based clinical care recommendations for any uncontrolled major cardiovascular risk factors to promote shared decision-making; and c) retained data from eligible encounters at intervention and control clinics in a data repository that was later mapped to electronic health record Clarity data to identify encounter-level ICD-10 diagnostic codes for diabetes, hypertension, hyperlipidemia, smoking, and obesity. Results: At 34,281 targeted encounters with 18,782 patients with reversible cardiovascular risk, mean age was 57.7, 50% were female, 13% were black, 6% Asian, 3% Hispanic, and 75% white, mean 10-year atherosclerotic cardiovascular disease (ASCVD) risk was 15.7%, and mean body mass index (BMI) was 33.0. Wizard handouts were printed for 75% of targeted encounters in intervention clinics. The percentage of encounters with ICD-10 codes identified were (control vs intervention, P-value): diabetes coded if diabetes identified (70.8% vs 74.5%, P<0.0001); hypertension coded if hypertension identified (57.9% vs 60.9%, P<0.0001); hyperlipidemia coded if statin intensification was indicated (29.9% vs 31.9%, P=0.005); ASCVD coded if ASCVD identified (24.7% vs 26.8%, P=0.051); obesity coded if BMI was ≥30 (14.8% vs 17.3%, P<0.0001); and smoking coded if current smoking identified (25.8% vs 32.4%, P<0.0001. Conclusion: This CDS system significantly increased the likelihood that known cardiovascular risk factors were assigned clinically appropriate ICD-10 diagnostic visit codes at primary care encounters.