Aquatic animals frequently undergo feed deprivation and starvation stress. It is well-known that the gut microbiota and the gut-brain short neuropeptide F (sNPF) play essential roles in diet restriction. Therefore, investigating the responses of the gut microbiota and sNPF can enhance our understanding of physiological adaptations to feed deprivation and starvation stress. In this study, we examined the alterations in the gut microbiota of juvenile mud crabs under feed deprivation and starvation conditions. The results reveal differences in the richness and diversity of gut microbiota among the satisfied, half food, and starvation groups. Moreover, the microbial composition was affected by starvation stress, and more than 30 bacterial taxa exhibited significantly different abundances among the three feeding conditions. These results indicate that the diversity and composition of the gut microbiota are influenced by diet restriction, potentially involving interactions with the gut-brain sNPF. Subsequently, we detected the location of sNPF in the brains and guts of mud crabs through immunofluorescence and investigated the expression profile of sNPF under different feeding conditions. The results suggest that sNPF is located in both the brains and guts of mud crabs and shows increased expression levels among different degrees of diet restriction during a 96 h period. This study suggested a potential role for sNPF in regulating digestive activities and immunity through interactions with the gut microbiota. In conclusion, these findings significantly contribute to our understanding of the dynamic changes in gut microbiota and sNPF, highlighting their interplay in response to diet restriction.