An experiment was carried out to evaluate the short-term effect of supplementing a nucleotide-rich yeast extract (NRYE) on growth performance, gut structure, immunity and microflora of piglets raised under sanitary and unsanitary conditions. A total of 84, 21-day old piglets were used in this study; 42 piglets were raised in a room designated as the clean room that was washed once per week, whereas the other 42 piglets were raised in a room designated as the unclean room in which 7 kg of manure from the sow herd was spread on each pen floor on day 1 and 7 and the room was not washed throughout the experiment. The pigs were fed a corn-soybean meal-based diet without or with 0.1% NRYE. Each treatment had 7 replicate pens in each room, and each pen housed 3 pigs. Feed disappearance and BW were recorded on day 1 and 14. On day 14, one pig per pen was euthanized to collect ileum, mesenteric lymph nodes and spleen tissues, and cecum and colon digesta. Overall, NRYE supplementation did not affect growth performance in both clean and unclean conditions, improved kidney weight in both clean (P=0.0002) and unclean room (P<0.0001) and tended to improve the villus height/crypt depth ratio in the clean room (P=0.073). Supplementing NRYE was associated with upregulation of Ileal programmed cell death gene-1 (P=0.0003), interleukin (IL)-1β (P<0.0001), IL-6 (P=0.0003), IL-10 (P<0.0001) and tumor necrosis factor-α (TNF-α) (P<0.0001) in pigs raised in the unclean room. Supplementing the NRYE in pigs raised in the clean room suppressed growth of cecal Enterobacteriacea (P<0.0001) members and colonic Enterococcus spp. (P<0.019), improved proliferation of cecal Lactobacillus spp. (P<0.002) and colonic Clostridium cluster IV (P<0.011) and XVIa members (P<0.0002). Supplementing the NRYE in the unclean room improved proliferation of cecal Clostridium cluster IV (P<0.026) and suppressed proliferation of colonic Enterococcus spp. (P<0.037). In conclusion, supplementing the NRYE to piglets under unsanitary conditions improved ileal immune response by upregulating inflammatory cytokines, and positively modulated proliferation of beneficial gut bacteria and suppression of harmful ones in both clean and unclean rooms.