First, notice that in verse 2:23, James quotes the same passage in Genesis 15:6 that Paul quotes in Romans 4:3, "Abraham believed God, and it was credited to him as righteousness." It’s clear that he doesn’t intend to argue against the concept of justification by faith, or to contradict Paul.