In this study designed to investigate the effect of diet and gut microbiome on neuropsychiatric disorders, we explored the mechanisms of the interaction between diet and gut microbiome on the risk of neuroticism. First, using the individual genotype data from the UK Biobank cohort (N = 306 165), we calculated the polygenic risk score (PRS) based on 814 dietary habits single nucleotide polymorphisms (SNPs), 21 diet compositions SNPs and 1001 gut microbiome SNPs, respectively. Gut microbiome and diet-associated SNPs were collected from three genome-wide association studies (GWAS), including the gut microbiome (N = 3890), diet compositions (over 235 000 subjects) and dietary habits (N = 449 210). The neuroticism score was calculated by 12 questions from the Eysenck Personality Inventory Neuroticism scale. Then, regression analysis was performed to evaluate the interaction effects between diet and the gut microbiome on the risk of neuroticism. Our studies demonstrated multiple candidate interactions between diet and gut microbiome, such as protein vs. Bifidobacterium (β = 4.59 × 10-3; P = 9.45 × 10-3) and fat vs. Clostridia (β = 3.67 × 10-3; P = 3.90 × 10-2). In addition, pieces of fresh fruit per day vs. Ruminococcus (β = -5.79 × 10-3, P = 1.10 × 10-3) and pieces of dried fruit per day vs. Clostridiales (β = -5.63 × 10-3, P = 1.49 × 10-3) were found to be negatively associated with neuroticism in fruit types. We also identified several positive interactions, such as tablespoons of raw vegetables per day vs. Veillonella (β = 5.92 × 10-3, P = 9.21 × 10-4) and cooked vegetables per day vs. Acidaminococcaceae (β = 5.69 × 10-3, P = 1.24 × 10-3). Our results provide novel clues for understanding the roles of diet and gut microbiome in the development of neuroticism.