Abraham was imputed righteous by God though, because of his faith.
Romans 4:18-20
18Against all hope, Abraham in hope believed and so became the father of many nations, just as he had been told, “So shall your offspring be.”
d 19Without weakening in his faith, he acknowledged the decrepitness of his body (since he was about a hundred years old) and the lifelessness of Sarah’s womb.
20Yet he did not waver through disbelief in the promise of God, but was strengthened in his faith and gave glory to God,
21being fully persuaded that God was able to do what He had promised. 22That is why “it was credited to him as righteousness.”e
23Now the words “it was credited to him” were written not only for Abraham,
24but also for us, to whom righteousness will be credited—for us who believe in Him who raised Jesus our Lord from the dead.
25He was delivered over to death for our trespasses and was raised to life for our justification.