We aimed to develop a prediction rule for urinary tract infections (UTIs) in patients with type 2 diabetes mellitus (DM2). A 12-month prospective cohort study was conducted in patients with DM2 aged ⩾45 years to predict the occurrence of recurrent UTIs in women and lower UTIs in men. Predictors for recurrent UTI in women (n=81, 2%) and lower UTIs in men (n=93, 3%) were age, number of general practitioner (GP) visits, urinary incontinence, cerebrovascular disease or dementia. In women, renal disease was an additional predictor. The optimum corrected area under the receiver-operating curve (AUC) was 0·79 (95% CI 0·74–0·83) for women and 0·75 (95% CI 0·70–0·80) for men. Using a cut-off score of 4, women with a lower risk assignment had a probability of 0·3% for the outcome. For a cut-off score of 6, women with a higher risk assignment had a probability of 5·8%. For men these figures were 0·8 and 7·1 for a cut-off score of 2 and 4, respectively. Simple variables can be used for the risk stratification of patients.