The wisdom literature of the Old Testament has much to say about the wicked and wickedness. Neither can dwell with God, and both will be brought to sure justice. One example of this is in Psalm 5:4-6:
For You are not a God who takes pleasure in wickedness; No evil dwells with You. The boastful shall not stand before Your eyes; You hate all who do iniquity. You destroy those who speak falsehood; The LORD abhors the man of bloodshed and deceit.
When we read passages like this, our natural response is to think, “Well, I’d better be good then, because I don’t want God to hate me or destroy me.”
And to a certain extent that is the right response, but sooner or later each person who tries to be good to avoid God’s hatred and destruction will be frustrated at their inability to accomplish their goal. That is because these statements about God’s hatred of wickedness are never meant to drive us to try to be good in and of ourselves; they are meant to lead us to an alien righteousness imputed to our accounts. Psalm 5 deals with this too, in v7-8
But as for me, by Your abundant lovingkindness I will enter Your house, At Your holy temple I will bow in reverence for You. O LORD, lead me in Your righteousness because of my foes; Make Your way straight before me.
Notice that the psalmist doesn’t dwell with God because he is good, but because God shows abundant lovingkindness. He doesn’t accomplish righteousness himself, but God leads him in righteousness. God imputes His own righteousness to those who turn to Him instead of trying to accomplish it themselves. Praise Him for His lovingkindness.