From Amir's point of view, Hassan is a means to an end. As a Hazara, Hassan is considered a second-class citizen by most Pashtuns, so Amir definitely doesn't see Hassan as an equal. In the novel, Amir betrays Hassan in order to win his father's esteem and affection.
We can trace Amir's heinous treatment of Hassan to his dysfunctional relationship with his father, Baba. At six-foot-five, Baba is a towering figure of a man. He is a typical Pashtun: dominant, proud, and unyielding. As a man who appreciates the fiercer side of things, Baba finds it difficult to comprehend his poetry-loving son. Realizing he has little talent for athletics, Amir must strive to gain what little paternal attention he can from Baba through other avenues. Alas, his efforts fall flat. At the yearly Buzkashi tournament, he cries when he sees a horseman trampled to death by his opponents' horses.
Later that night, he overhears Baba telling Rahim Khan that Amir is missing the necessary "mean streak" all self-respecting boys should have. Baba is ashamed Hassan has to step in to rescue Amir when the neighborhood boys tease him. Baba's last words to Rahim Khan are especially hurtful:
But something about Amir troubles me in a way that I can't express. . . If I hadn't seen the doctor pull him out of my wife with my own eyes, I'd never believe he's my son.
Baba's obvious preference for Hassan and extreme disdain for what he considers Amir's weakness leads to resentment on Amir's part. Later, Amir betrays Hassan twice in order to preserve his place in Baba's affections. The first betrayal occurs when he neglects to come to Hassan's aid during his rape. Amir's only interest is in winning the kite tournament, and he callously ignores Hassan's misery when Hassan hands him the kite he retrieved. Even though Amir notices Hassan is bleeding from between his legs, Amir decides his father's esteem is worth Hassan's suffering.
The second betrayal occurs when Amir accuses Hassan of stealing his watch and money. Ashamed of himself after his first betrayal of Hassan, Amir tries to manufacture a crisis to get rid of Hassan, a constant reminder of Amir's guilt, entirely. He imagines that, with Hassan gone, Baba will look at him with different eyes. Things don't work out as he plans, though. Unknown to Amir, Hassan is Baba's illegitimate son, and Baba is genuinely upset when the boy leaves with Ali. Far from gaining Baba's esteem, Amir falls even lower in Baba's estimation.
Due to his ambivalent and conflict-ridden relationship with Baba, Amir treats Hassan contemptuously and callously.