Two extremes should be avoided: treating a helpful contributor as beyond criticism, or denying every genuine benefit of their lawful work because of a personal fault. The words بِالرَّجُلِ الْفَاجِرِ make this distinction clear.
A person still needs to care about both intention and conduct. A good aim does not excuse wrongful methods, and one beneficial action is not a final verdict on someone's whole life.
الْفَاجِرِ describes الرَّجُلِ. Both carry the genitive ending because the preposition بِـ introduces the phrase. This is a simple example of adjective agreement.