Was it an unrighteous man that Jehovah called out of Mesopotamia years earlier, appeared to several times, and announced blessings upon, BEFORE Genesis 15:6?
Was it an unregenerate man that built an altar to Jehovah at Shechem years earlier, BEFORE Genesis 15:6?
Was it to a dead alien sinner that Melchizedek pronounced 'Blessed be Abram of God Most High' years earlier, BEFORE Genesis 15:6?
Abraham didn't become righteous at Genesis 15:6, he was PRONOUNCED to be righteous.
Gen 15:6 And Abram believed God, and it was
counted to him for righteousness. Brenton
Gen 15:6 Abram believed the LORD, and it was
credited to him as righteousness. BSB
Gen 15:6 And he believed in the LORD, and He
accounted it to him for righteousness NKJV
Gen 15:6 Abram believedN20 the LORD, and the LORDN21
considered his response of faithN22 as proof of genuine loyalty.N23 NET
Gen 15:6 Then he believed in the LORD; and He
reckoned it to him as righteousness. NASB
Gen 15:6 And he believed in Jehovah, and he
credited it to him as righteousness. UASV
Gen 15:6 And he believed the LORD; and the LORD
reckoned it to him as righteousness. NRSV
Gen 15:6 And Abram believed the LORD, and the LORD
counted him as righteous because of his faith. NLT
Abraham was not righteous, none of us are truly righteous. We all sin. But God accounted his faith for righteousness just as He does ours.