Objectives: To investigate whether the prevalence of HIV infection among young people, and sexual behaviours associated with increased HIV risk, are differentially distributed between students and those not attending school or college.Design: A random population sample of unmarried young people (916 males, 1003 females) aged 14â€“25 years from rural South Africa in 2001.Methods: Data on school attendance and HIV risk characteristics came from structured face-to-face interviews. HIV serostatus was assessed by oral fluid ELISA. Logistic regression models specified HIV serostatus and high-risk behaviours as outcome variables. The primary exposure was school attendance. Models were adjusted for potential confounders.Results: HIV knowledge, communication about sex and HIV testing were similarly distributed among students and non-students. The lifetime number of partners was lower for students of both sexes (adjusted odds ratio (aOR) for more than three partners for men 0.67; 95% CI 0.44 to 1.00; aOR for more than two partners for women 0.69; 95% CI 0.46 to 1.04). Among young women, fewer students reported having partners more than three years older than themselves (aOR 0.58; 95% CI 0.37 to 0.92), having sex more than five times with a partner (aOR 0.57; 95% CI 0.37 to 0.87) and unprotected intercourse during the past year (aOR 0.60; 95% CI 0.40 to 0.91). Male students were less likely to be HIV positive than non-students (aOR 0.21; 95% CI 0.06 to 0.71).Conclusions: Attending school was associated with lower-risk sexual behaviours and, among young men, lower HIV prevalence. Secondary school attendance may influence the structure of sexual networks and reduce HIV risk. Maximising school attendance may reduce HIV transmission among young people.