Was not Abraham our father justified by works, when he had offered
Isaac his son upon the altar?

The supposed contradiction is that Paul wrote in Romans that Abraham was justified by faith not works but James writing that Paul was justified by works. The problem with this is that people are confused not the Bible. If you go back and look at the context.of each passage you have to come to the conclusion that Paul was not talking about the same kinds of works that James is talking about. Paul is specifically talking about keeping the Mosaic Law in general and circumcision particular.. James is talking about doing good things for others such as taking care of widows and orphans. Therefore they are in no conflict.

What then shall we say that Abraham, [a]our forefather according to the flesh, has found?2 For if Abraham was justified [b]by works, he has something to boast about, but not [c]before God.3 For what does the Scripture say? “Abraham believed God, and it was credited to him as righteousness.”4 Now to the one who works, his wage is not credited as a favor, but as what is due.5 But to the one who does not work, but believes in Him who justifies the ungodly, his faith is credited as righteousness,6 just as David also speaks of the blessing on the man to whom God credits righteousness apart from works:

7 “Blessed are those whose lawless deeds have been forgiven,And whose sins have been covered.8 “Blessed is the man whose sin the Lord will nottake into account.”

9 Is this blessing then on [d]the circumcised, or on [e]the uncircumcised also? For we say, “Faith was credited to Abraham as righteousness.”10 How then was it credited? While he was [f]circumcised, or [g]uncircumcised? Not while [h]circumcised, but while [i]uncircumcised;11 and he received the sign of circumcision, a seal of the righteousness of the faith which [j]he had while uncircumcised, so that he might be the father of all who believe without being circumcised, that righteousness might be credited to them,12 and
the father of circumcision to those who not only are of the
circumcision, but who also follow in the steps of the faith of our
father Abraham which [k]he had while uncircumcised.13 For the promise to Abraham or to his [l]descendants that he would be heir of the world was not [m]through the Law, but through the righteousness of faith.14 For if those who are [n]of the Law are heirs, faith is made void and the promise is nullified;15 for the Law brings about wrath, but where there is no law, there also is no violation.16 For this reason it is[o]by faith, in order that it may be in accordance with grace, so that the promise will be guaranteed to all the [p]descendants, not only to [q]those who are of the Law, but also to [r]those who are of the faith of Abraham, who is the father of us all,17 (as it is written, “A father of many nations have I made you”) in the presence of Him whom he believed, even God, who gives life to the dead and [s]calls into being that which does not exist.- Romans 1:1-17

So in context, Paul is not saying that you don't have to do good works. Only that those good works don't save you. Your faith in Christ is what saves you.

8 For by grace you have been saved through faith; and [h]that not of yourselves, it is the gift of God;9 not as a result of works, so that no one may boast.10 For we are His workmanship, created in Christ Jesus for good works, which God prepared beforehand so that we would walk in them. - Ephesians 2:8-10

Same author as Romans!As for James's context. One must read his letter and let God speak through him.

14 What use is it, my brethren, if someone says he has faith but he has no works? Can [n]that faith save him?15 If a brother or sister is without clothing and in need of daily food,16 and one of you says to them, “Go in peace, [o]be warmed and be filled,” and yet you do not give them what is necessary for their body, what use is that?17 Even so faith, if it has no works, is [p]dead, being by itself.18 But someone [q]may well say, “You have faith and I have works; show me your faith without the works, and I will show you my faith by my works.”19 You believe that [r]God is one. You do well; the demons also believe, and shudder.20 But are you willing to recognize, you foolish fellow, that faith without works is useless?21 Was not Abraham our father justified by works when he offered up Isaac his son on the altar?22 You see that faith was working with his works, and [s]as a result of the works, faith was [t]perfected;23 and the Scripture was fulfilled which says, “And Abraham believed God, and it was reckoned to him as righteousness,” and he was called the friend of God.24 You see that a man is justified by works and not by faith alone.25 In the same way, was not Rahab the harlot also justified by works when she received the messengers and sent them out by another way?26 For just as the body without the spirit is dead, so also faith without works is dead. - James 2:14-26

So what kind of f works is faith dead without? It's not following traditions and paying lip service to God without living out God's commands is it? Nope. That is the kind of works Paul was referring to in Romans. The kind of works James is clearly discussing is helping and serving others - explicit in James 2:15. And he took on this point even earlier.

26 If anyone thinks himself to be religious, and yet does not [ab]bridle his tongue but deceives his own heart, this man’s religion is worthless.27 Pure and undefiled religion in the sight of our God and Father is this: to visit orphans and widows in their distress, and to keep oneself unstained [ac]by the world. - James 1:26-27

So if one is honest, you must conclude that there is no contradiction here!