Abstract Introduction Obstructive sleep apnea (OSA) is associated with cognitive impairments. However, in many adequately powered randomized trials, there is weak or no evidence for the causal effect of treating OSA on cognition. A common characteristic of these randomized trials is heterogeneous participants. We hypothesize that there is a subset whose cognition could be improved by OSA treatment using CPAP. Methods This is a secondary analysis of the Apnea Positive Pressure Long-term Efficacy Study (APPLES), a randomized, double-blind, two-arm, sham-controlled, multicenter trial. The primary analysis had adult participants with baseline AHI ≥10/hour. We restricted to those with both baseline polysomnogram and outcome available: n=787. The outcome is 6-month Sustained Working Memory Overall index at mid-day, which was not significantly different in the primary analysis. The original exposure is randomized active- or sham-CPAP. However, the adherence rate (≥4 hours for >70% nights in 1-month) is higher for active than sham (chi2 p< 0.001). Therefore, we re-defined a non-randomized exposure as both under active-CPAP and being adherent (n=165) vs. all others (n=622). To account for confounding, covariates were clustered into 17 groups, plus age, sex, education, and baseline cognition. Individual treatment effect (ITE) was estimated using matching, which finds a matched group for each individual with similar covariates but opposite exposure. The ITE is the difference between two potential outcomes: the counterfactual outcome from the mean outcome of the matched group, and the factual outcome as observed. Results The overall ITE was non-significant compared to 0 (t-test p=0.4). A subset of 285 (Group 1) could have improved cognition if under active-CPAP and adherent (average ITE 0.68, p< 0.001); another subset of 328 (Group 2) could have worsened cognition (average ITE -0.64, p< 0.001). Group 1 is characterized by more males, higher baseline cognitive scores, lower EEG-derived brain age index, and slightly more depression; the opposite for Group 2. Conclusion Assuming the ITE is unbiased, relatively brain-healthy males with OSA can improve their cognition once OSA is treated by CPAP. Support (if any) MBW was supported by NIH (R01NS102190, R01NS102574, R01NS107291, RF1AG064312). RT received support from RF1AG064312. AVZ received the Parker B. Francis Fellowship award. JJL was supported by NIH UL1TR002541.