Evidence from previous observational studies suggest that infection by herpes simplex virus (HSV) and varicella zoster virus (VZV) increase the risk of dementia. To investigate if older adults exposed to HSV treatment have lower risk of dementia than the rest of the population. We used the 10% Australian Pharmaceutical Benefits Scheme (PBS) database from 2013 to 2022 to ascertain the cross-sectional, time-series and longitudinal association between exposure to HSV treatment and the dispensing of antidementia medicines. Participants were men and women aged 60 years or older. We used Anatomical Therapeutic Chemical (ATC) codes to identify medicines dispensed for the treatment of HSV and dementia. During the year 2022 6,868 (1.2%) of 559,561 of participants aged 60 years or over were dispensed antidementia agent. The odds ratio (OR) of being dispensed an antidementia agent among individuals dispensed treatment for HSV was 0.73 (99% CI = 0.56-0.95). Multilevel logistic regression for the 2013-2022 period for those dispensed HSV treatment was 0.87 (99% CI = 0.75-1.00). Split-time span series from 2013 was associated with hazard ratio of 0.98 (99% CI = 0.89-1.07) for individuals dispensed relative to those not dispensed HSV treatment. All analyses were adjusted for age, sex, and the dispensing of medicines for the treatment of diabetes, hyperlipidemia, hypertension, and ischemic heart disease. The dispensing of antiviral medicines for the treatment of HSV and VZV is consistently, but not conclusively, associated with decreased dispensing of antidementia medicines. This suggests that treatment of HSV and VZV infections may contribute to reduce the risk of dementia.