There is more than one way to get around this. You can write brilliantly so that there's other things going on with the musicality of your prose, its sheer poetry, to keep readers interested (which won't work on all readers). You can make sure your character is at least well rounded (as all protagonists should be) and that there are enough good characteristics to keep readers on-side. You can start with the good and gradually reveal the bad. Or you can trick your reader and suddenly reveal some abhorrent characteristic that totally puts the reader off.
Okay, I don't really recommend the last, but I've just had that experience as a reader, so clearly not all writers agree with me. Two thirds of the way into a book I've been reading, and the main character has done something that has left me so cold I'm not sure I want to continue. I liked this character. I empathised with him completely, but any empathy vanished with that one cruel act. It's something that was foreshadowed, so I shouldn't have been surprised, but I was led to a point where it seemed unavoidable and I was spared, so I relaxed and, then, when I wasn't expecting it: bang.
It's unusual for me to have such a strong reaction. But then this particular action was always going to be difficult for me to get over. Leaving it so late -- well, I feel manipulated. Two-thirds of the way in, I don't really want to abandon a story I was enjoying, but now I don't want to stay with this character at all. I suppose I will finish it -- my son asked me to read it because he wants to discuss it with me (and, no, it's not one of his school texts). He says it's one of his favourite books, and I mull over what's just happened and think, how can it be? But we're all different readers -- we all want something different, something we writers have to bear in mind.