Stereotype threat, or the fear of confirming a negative stereotype about one's social group, may contribute to racial differences in adherence to medications by decreasing patient activation to manage chronic conditions. To examine whether a values affirmation writing exercise improves medication adherence and whether the effect differs by patient race. The Hypertension and Values trial, a patient-level, blinded randomized clinical trial, compared an intervention and a control writing exercise delivered immediately prior to a clinic appointment. Of 20 777 eligible, self-identified non-Hispanic Black and White patients with uncontrolled hypertension who were taking blood pressure (BP) medications, 3891 were approached and 960 enrolled. Block randomization by self-identified race ensured balanced randomization. Patients enrolled between February 1, 2017, and December 31, 2019, at 11 US safety-net and community primary care clinics, with outcomes assessed at 3 and 6 months. Analysis was performed on an intention-to-treat basis. From a list of 11 values, intervention patients wrote about their most important values and control patients wrote about their least important values. The primary outcome of adherence to BP medications was measured using pharmacy fill data (proportion of days covered >90%) at baseline, 3 months, and 6 months. The secondary outcome was systolic and diastolic BP. Patient activation to manage their health was also measured. Of 960 patients, 474 (286 women [60.3%]; 256 Black patients [54.0%]; mean [SD] age, 63.4 [11.9] years) were randomly assigned to the intervention group and 486 (288 women [59.3%]; 272 Black patients [56.0%]; mean [SD] age, 62.8 [12.0] years) to the control group. Baseline medication adherence was lower (318 of 482 [66.0%] vs 331 of 412 [80.3%]) and mean (SE) BP higher among Black patients compared with White patients (systolic BP, 140.6 [18.5] vs 137.3 [17.8] mm Hg; diastolic BP, 83.9 [12.6] vs 79.7 [11.3] mm Hg). Compared with baseline, pharmacy fill adherence did not differ between intervention and control groups at 3 months (odds ratio [OR], 0.91 [95% CI, 0.57-1.43]) or at 6 months (OR, 0.86 [95% CI, 0.53-1.38]). There were also no treatment effect differences in pharmacy fill adherence by patient race (Black patients at 3 months: OR, 1.08 [95% CI, 0.61-1.92]; at 6 months: OR, 1.04 [95% CI, 0.58-1.87]; White patients at 3 months: OR, 0.68 [95% CI, 0.33-1.44]; at 6 months: OR, 0.55 [95% CI, 0.24-1.27]). Immediately after the intervention, the median patient activation was higher in intervention patients than in control patients, but this difference was not statistically significant in an unadjusted comparison (75.0 [IQR, 65.5-84.8] vs 72.5 [IQR, 63.1-80.9]; P = .06). In adjusted models, the Patient Activation Measure score immediately after the intervention was significantly higher in the intervention patients than in control patients (mean difference, 2.3 [95% CI, 0.1-4.5]). A values affirmation intervention was associated with higher patient activation overall but did not improve adherence or blood pressure among Black and White patients with hypertension. ClinicalTrials.gov Identifier: NCT03028597.