Purpose This study aims to study the distribution characteristics of antibiotic resistance in direct-eating food and analysis of Citrobacter freundii genome and pathogenicity. Residual antibiotics and antibiotic resistance genes (ARGs) in the environment severely threaten human health and the ecological environment. The diseases caused by foodborne pathogenic bacteria are increasing daily, and the enhancement of antibiotic resistance of pathogenic bacteria poses many difficulties in the treatment of disease. Design/methodology/approach In this study, six fresh fruits and vegetable samples were selected for isolation and identification of culturable bacteria and analysis of antibiotic resistance. The whole genome of Citrobacter freundii isolated from cucumber was sequenced and analyzed by Oxford Nanopore sequencing. Findings The results show that 270 strains of bacteria were identified in 6 samples. From 12 samples of direct food, 2 kinds of probiotics and 10 kinds of opportunistic pathogens were screened. The proportion of Citrobacter freundii screened from cucumber was significantly higher than that from other samples, and it showed resistance to a variety of antibiotics. Whole genome sequencing showed that Citrobacter freundii was composed of a circular chromosome containing signal peptides, transmembrane proteins and transporters that could induce antibiotic efflux, indicating that Citrobacter freundii had strong adaptability to the environment. The detection of genes encoding carbohydrate active enzymes is more beneficial to the growth and reproduction of Citrobacter freundii in crops. A total of 29 kinds of ARGs were detected in Citrobacter freundii, mainly conferring resistance to fluoroquinolones, aminoglycosides, carbapenem, cephalosporins and macrolides. The main mechanisms are the change in antibiotic targets and efflux pumps, the change in cell permeability and the inactivation of antibiotics and the detection of virulence factors and ARGs, further indicating the serious risk to human health. Originality/value The detection of genomic islands and prophages increases the risk of horizontal transfer of virulence factors and ARGs, which spreads the drug resistance of bacteria and pathogenic bacteria more widely.