Sertraline is widely prescribed to treat anxiety and depression. Sertraline acts by blocking serotonin, norepinephrine, and dopamine transporters systems and has been detected in surface waters globally where it may impact fish behavior. We classified zebrafish personality on three behavioral axes: boldness, anxiety and sociability, assigning fish as either high or low in each category. The fish were exposed to nominal concentrations of 0, 5, 50, 500, or 5000 ng/L sertraline (measured concentrations: <10, 21.3, 370 and 2200 ng/L respectively) to assess changes in boldness, anxiety and sociability after seven and 28 days. We also measured shoaling behavior and response to an alarm cue, and determined the gut microbiome of a subset of fish. After seven days there was no overall effect of sertraline on boldness, but there was an interaction between initial personality and sex, with a stronger impact on females classified as low‐boldness personality. Sertraline reduced sociability in all treatments compared with the control, but there was again an interaction between sertraline and initial personality. Fish that were classified as low‐sociability responded more strongly to sertraline. After seven days, fish exposed to a nominal concentration of 5000 ng/L (2200 ng/L measured) showed higher anxiety than controls with the overall pattern of initial behavior retained. After 28 days, similar patterns were observed, but with higher variation. There was only a weak association between the gut microbiome and personality. Overall, the study highlights the importance of considering initial behavior and that it can affect response to pollutants. Our results may also be applicable to human studies and provide a mechanism to explain why different individuals respond differently to the drug.