Huck struggles with the conflict between doing the "right thing" by conventional standards, or what society deems to be acceptable behavior, and his feelings of camaraderie and friendship with Jim. A deeper analysis suggests that Jim acts as surrogate father for Huck, and Huck serves as a surrogate family for Jim, who was forced to leave his behind. So the question becomes should Huck turn in a runaway slave, and do what is right by what his religion and socialization tell him, and violate his friendship with Jim, or continue to remain on the outside of the culture as an outcast with Jim, and preserve his friendship with him? As he struggles for guidance, he decides to pray for an answer, to do the right thing socially, but realizes he cannot invalidate his love for Jim--he cannot "pray a lie." This is significant, because the conventional morality of his conscience then tells him he'll go to hell for that decision--but he accepts that and won't violate Jim's friendship. Although Huck Finn was published 20 years after the Civil War, it recalls the time when a slave had no standing as a person, unlovable, outcast, and fit only for labor. Huck has enough humanness to see through this, and heroically is willing to pay the price to act upon it by not returning Jim to slavery.
Mark Twain's character Huckleberry Finn is conflicted between what he believes is 'right' and what the forces of society define as 'right'. The boy is wise to societal hypocrisy, however because he is just a boy he is subject to the pressures of that society. Huckleberry loves Jim and the society with which he lives says that is wrong. How better to subjugate a young person to the 'powers that be' than to insist that his 'bad' behavior (in this case his feelings towards Jim) are the result of his inability to conform to the demands of his society, rather than to suggest he has a geniune mind and morality of his own.
(There is a Huckleberry Finn Group on the enotes site. It can be very helpful to you with regard to this novel.)