[Since there will be very different views on this matter, I've kept my answer in first-person to indicate that this is my viewpoint and not a guideline of a sort.]
Whilst I agree with the comments that to an extent, it is perfectly natural to respond differently to different levels of engagement, I think a good strategy is to consider the world outside of the classroom and remember that behaviour in the classroom is a product of many causes.
I do this when I teach and I notice that I start disliking students for not turning up, lack of engagement etc. I then recall my first year at Undergrad level. I was severely depressed, attended barely 20% of my classes, just about managed to pass the year. I am sure I must have appeared absent, disinterested, the sort of student that my lecturers would ask "why would they be here in the first place if they don't attend anything?" - but my classroom behaviour (or rather, the absence of it) had absolutely nothing to do with the classroom itself, nor the teaching, not even the material.
My personal background helps me to consider such a scenario- but I think there are plenty of other things, such as:
- undisclosed/not-diagnosed disabilities and/or illnesses affecting students
- international students having to find their way in a very foreign world
- related to 2., oftentimes young students and their first experience abroad, on their own
- family background: crises at home, responsibilities for parents/grandparents/siblings that would not normally be considered
- Perhaps just the natural way of things: students realise that what they thought they would love to study turns out to have been an illusion. They are not at the stage of dropping out (possibly due to parental/financial pressures) but are clearly not willing to
Whatever they do, I try to refrain from judgements on their character as much as I can. When a student is not responsive to my teaching, it does not necessarily imply a judgement on me, either.