damn by association
To condemn, vilify, or discredit someone or something due to an association with a particular person, group, or thing. The multinational corporation was damned by association when it came to light that an employee of one of its subsidiaries belonged to a white supremacist organization. After the terrorist attack, many people were quick to damn by association anyone who belonged to the same faith as the terrorists.