Gut microbiome profoundly affects many aspects of host physiology and behaviors. Here we report that gut microbiome modulates aggressive behaviors in Drosophila. We found that germ-free males showed substantial decrease in inter-male aggression, which could be rescued by microbial re-colonization. These germ-free males are not as competitive as wild-type males for mating with females, although they displayed regular levels of locomotor and courtship behaviors. We further found that Drosophila microbiome interacted with diet during a critical developmental period for the proper expression of octopamine and manifestation of aggression in adult males. These findings provide insights into how gut microbiome modulates specific host behaviors through interaction with diet during development.