Stenotrophomonas maltophilia is an emerging drug-resistant pathogen and an important opportunistic pathogen. S. maltophilia flagellin was purified using serial ultracentrifugation. The purity of flagellin was checked by SDS-PAGE. The antibodies were raised in rabbits. The presence of anti-flagellin and the titer of flagellin were detected by immunoblotting and bacterial agglutination techniques. Two methods (viable bacterial count and spectrophotometric methods) were applied to evaluate bacterial adhesion and biofilm formation. Pretreatment of S. maltophilia with dilutions of anti-flagellin (from 1/40 to 1/640) reduced the ability of S. maltophilia to adhere and form biofilms on polystyrene (P < 0.05). In the present study, the inhibition of bacterial adhesion to polystyrene was dose-dependent. The positive correlation was observed between the antibody dilutions and bacterial adhesion (CFU/mL) (r > +0.5, P < 0.05), while, the negative correlation (r < −0.5, P < 0.05) was observed between the percentage of adhesion inhibition and anti-flagellin dilutions. The current study proved the direct role of S. maltophilia flagellin in bacterial adhesion to and biofilm formation on polystyrene.