That is what you imagine. But you are completely mistaken. Long BEFORE Abraham obeyed God in offering up Isaac as a sacrifice (over 40 years before) God imputed righteousness to Abraham.It was Abraham's obedience based on his belief in God's words that was only imputed as righteousness.
GENESIS 15: ABRAHAM BELIEVED GOD AND IT WAS IMPUTED TO HIM FOR RIGHTEOUSNESS
1After these things the word of the LORD came unto Abram in a vision, saying, Fear not, Abram: I am thy shield, and thy exceeding great reward. 2 And Abram said, Lord GOD, what wilt thou give me, seeing I go childless, and the steward of my house is this Eliezer of Damascus? 3 And Abram said, Behold, to me thou hast given no seed: and, lo, one born in my house is mine heir. 4 And, behold, the word of the LORD came unto him, saying, This shall not be thine heir; but he that shall come forth out of thine own bowels shall be thine heir. 5 And he brought him forth abroad, and said, Look now toward heaven, and tell the stars, if thou be able to number them: and he said unto him, So shall thy seed be. 6 And he believed in the LORD; and he counted it to him for righteousness.
In the Septuagint, the wording corresponds more to what we read in the New Testament: And Abram believed God, and it was counted to him for righteousness.
We see here that Abraham believed God and His promise to give him an heir and also an innumerable number of descendants, even though it appeared totally impossible. We believe God to save us in and through the Lord Jesus Christ, and He imputes the righteousness of Christ to us, even though it seems impossible. But the obedience of Abraham came a long time after.