Hi there is no contradictions between the two verses, James 2:21 talks about the faith of Abraham through works that he did as an example of one that has faith by offering his only son to God. The passage in Romans 3:26 speak of faith as a determining factor for the those in the world that display belief in the sacrificial death of Jesus that led to being judged worthily of salvation. In one passage there is an example of someone’s action and another passages that tells how the world can be counted worthily through works of faith for salvation.
Romans 3:26
Easy-to-Read Version
25-26 God gave Jesus as a way to forgive people’s sins through their faith in him. God can forgive them because the blood sacrifice of Jesus pays for their sins. God gave Jesus to show that he always does what is right and fair. He was right in the past when he was patient and did not punish people for their sins. And in our own time he still does what is right. God worked all this out in a way that allows him to judge people fairly and still make right any person who has faith in Jesus.
James 2:21
Modern English Version
21 Was not Abraham our father justified by works when he offered his son Isaac on the altar?