A former headteacher has appeared in court where he denied sexual activity with a pupil.