I'm not sure why you would feel the need to tell him anything, unless he is either asking you out, or is actively 'persuing' you. You don't have to explain yourself to anyone, at any time.
However, if you don't want to encourage advances from anyone, male or female ... The routine is the same. You tell them you are in a relationship (if you are) or find an appropriate moment to say you are gay in either a direct manner by saying 'I'm gay" or an indirect and discrete manner by saying something about your orientation, a previous or even current relationship or something of that effect in a conversational manner.