Feature extraction methods are increasingly used to study associations between clinical phenotypes and complex patterns in the brain. However, these methods typically do not account for nuisance variables (e.g., confounders), which may preclude generalizability and interpretability of results. Motivated by this critical issue, in this work we propose Penalized Decomposition Using Residuals (PeDecURe), which estimates primary directions of variation that simultaneously maximize covariance between a variable of interest and partially residualized features and minimize covariance with nuisance variables. We apply our method to structural neuroimaging data from the Alzheimer’s Disease Neuroimaging Initiative (ADNI) and train a model to predict Alzheimer’s diagnosis. Compared with models trained using features derived using existing methods, the PeDecURe model offers improved disease prediction, lower correlations with confounders (age and sex), and greater generalizability. PeDecURe may also be used for dimension reduction in other areas research where novel methods for handling nuisance variables are warranted.