Long-term adherence to medication helps prevent chronic diseases. When patients adhere poorly, physicians intervene to increase this adherence. Therefore, knowing which patients will stop adhering would help distribute the available resources effectively. We study a long-term adherence prediction model using dynamic logistic regression that can inform clinicians about which patients are likely to stop adhering and when. We applied our model to longitudinal data for cardiovascular diseases in a large cohort of patients seen in the national Veterans Affairs health system. Additionally, we show the importance of including past adherence to increase prediction accuracy. Finally, we assess the potential benefits of using the prediction model to allocate interventions to patients under budget constraints.