A former headteacher has pleaded not guilty to sexual activity with a child while in a position of trust.