Dandruff can be prevented by using anti-dandruff products that contain ingredients such as pyrithione zinc, salicylic acid, selenium sulfide, and tea tree oil. It is important to avoid hair products that contain harmful ingredients such as sulfates, parabens, formaldehyde, and coal tar. A holistic approach to combating dandruff is also recommended, which includes maintaining a healthy diet, managing stress, and avoiding excessive use of hair styling products.