James warns against showing partiality and illustrates it with giving better treatment to the rich than the poor (James 2:1–4). He calls such distinctions "judges with evil thoughts" in his example (James 2:4).
James 2:1–7 confronts favoritism inside the community gathering. James tells his readers not to hold their allegiance to “the Lord of glory” while also treating people differently based on appearance and status. He sketches a scene where a wealthy visitor is honored and a poor visitor is publicly diminished. James has been urging a whole-life response that matches what people say they believe. Just before this, he describes “pure” worship as practical care for the vulnerable and resisting the world’s stains (James 1:27).
James treats favoritism as a direct contradiction of allegiance to Jesus. The opening line joins two things that cannot fit together in James’s view: holding “the faith of our Lord Jesus Christ, the Lord of glory” while also ranking people by outward status (verse 1).
A careful answer keeps the immediate passage, the book's argument, and the whole-Bible storyline together, so the question is answered in context instead of as a detached idea.
Start with James 2:1-4, then read the surrounding section so the answer stays connected to the passage's flow.
1My brothers, don`t hold the faith of our Lord Jesus Christ, [the Lord] of glory, with respect of persons.
2For if a man with a gold ring, in fine clothing, comes into your assembly, and there come in also a poor man in filthy clothing;
3and you pay special attention to him who wears the fine clothing, and say, "Sit here in a good place;" and you tell the poor man, "Stand there," or "Sit by my footstool;"
4haven`t you shown partiality among yourselves, and become judges with evil thoughts?