"In James it says that Abraham was righteous by both his works and his faith. But In Genesis 12 and 20 it says he was deceptive, he caused Sarah to be an adulteress, and he was married to his sister. How can anyone think Abraham was righteous?"
In Genesis 15.6 we read that Abraham "believed the Lord; and the Lord reckoned it to him as righteousness." In this passage it is clearly Abraham's faith that reckoned him as righteous. However, in James we do read that Abraham's righteousness was based both on his deeds and his faith: "Was not our ancestor Abraham justified by works when he offered his son Isaac on the altar? You see that faith was active along with his works, and faith was brought to completion by the works. Thus the scripture was fulfilled that says, 'Abraham believed God, and it was reckoned to him as righteousness,' and he was called the friend of God" (James 2.21-23). So, at least for the New Testament church, Abraham was considered righteous not only in faith but by his works.
But how can that be, given Abraham's history? In Genesis 12 and 20 we read the stories of Abraham and his wife Sarah traveling south to escape a severe drought in Palestine. Apparently Sarah was an attractive woman and in Genesis 12 Abraham tells Sarah that if the Egyptians make advances to her that she should say she was Abraham's sister, that way they wouldn't kill him to get his wife. The Pharaoh does find Sarah attractive and makes inquiries. When he discovers she is "available" he takes her into his household/harem. In Genesis 20 we read a second story very similar to Genesis 12. In this account it is Abraham who wells the ruler that Sarah is his sister. In both stories a catastrophe is visited upon the rulers' households because Sarah is actually Abraham's wife. In Genesis 20, Abraham tries to wiggle out of his deception by saying, "Besides, she is indeed my sister, the daughter of my father but not the daughter of my mother; and she became my wife" (Genesis 20.12).
Now, most scholars believe Genesis 12 and 20 are two different accounts of the same story by two different authors (J and E), so to be fair we won't count each offense twice. The list of indiscretions include: inciting Sarah to lie, causing her to sleep with another, and marrying his half-sister. Hardly a man most people would admire.
And yet, scripture heralds Abraham not only as the father of two nations (Israel and Arabia), and the father of Judaism, Islam, and Christianity, but a man to be revered and respected. Why?
Well, according to the psalmist there are none who are righteous (Psalm 53.3) -- "No, not one." One of the great beauties of scripture is that it pulls no punches. The Bible not only shows the mercy, justice, and kindnesses of a person, but also their faults and foibles. King David is portrayed as a murdering adulterer and a pretty poor parent to boot. Job accuses God of being less than fair. Moses loses his temper -- repeatedly. And Abraham is no different from any of the other great biblical characters.
Righteousness is the aspiration. Life is the reality. Abraham (and David, Job, and Moses) strove for righteousness in their lives, but life got in the way sometimes and they made bad choices. Often their choices cost them dearly, while at other times we just don't know what it cost them. Certainly their poor choices brought them guilt and often shame. It's not that they wanted to miss-the-mark, but. . . .
And that's where God comes in. The neat thing about God is it's God who decides about righteousness. The word "righteous" means literally right-relationship and if God's children (that would be you and me) are interested in being in a right-relationship with God, then God is willing, indeed eager, to be in a right-relationship with us. It's all a matter of reaching out, or reaching in as the case might be, to participate in that relationship.
And apparently Abraham reached out to God and God reached right back. Abraham was declared righteous because of his faith and because he kept on reaching out to God again and again. It wasn't that he was a better man than others, but simply that he was faithful in his relationship with God -- he kept coming back. And God reckoned it as righteousness -- and does the same for us if we're willing.