How would a Christian explain the contradiction of loving but calling homosexuality a sin? In the Bible it is said many times that homosexuality is a sin.

It is also said that love is the most important thing, and compassion is important as well; love your neighbor as yourself.  

This appears to be a contradiction - in calling something a sin and yet being called to love. 

How do Christians explain what seems to be a contradiction here?
No contradiction at all.  We are, indeed, commanded to love our neighbors.  We are also told that homosexuality is a sin.  How is there any contradiction in that?

Loving our neighbors does not require us to approve of everything they do.  Lying, stealing, adultery, profanity and greed are also defined as sins in the Bible.  If loving our neighbor demands we approve of everything they do, then we would need to approve of all of these.

We could go farther and include more heinous sins as well.

It is important to note that a biblical understanding of sin is that all sin is to our destruction and loss.  Loving someone would then require us to dislike anything that threatens to harm them, whether it be greed, pride, adultery, homosexuality or anything.  

We don't allow our children to play in the streets because we love them and don't want them to be harmed.  It would only be if we hated someone that we would want them to experience harm.