Nutrition and infection are closely linked. While it is now well established that hosts can modulate their nutrition after being infected, the extent to which this change in foraging provides the host with a greater fitness remains to be fully understood. Our study explored the relationships between dietary choice, macronutrients intake [i.e., protein (P) and carbohydrate (C)], infection, survival rate and growth of pathogenic bacterial population in the true fruit fly Bactrocera tryoni. Results showed that flies injected with the bacterium Serratia marcescens decreased their macronutrient intake and shifted their diet choice to carbohydrate-biased diet compared to naïve individuals. Interestingly, flies injected with either PBS (i.e., sham-infected) or heat-killed bacteria also reduced food intake and modulated diet choice but only for a day after injection. When infected flies were restricted to the diet they selected (i.e., PC 1:8), they survived better the infection than those restricted to a protein-biased diet (i.e., PC 1:5). In addition, we did not observe any growth of pathogen load in infected flies fed PC 1:8 for the first 3 days post-infection. Finally, a decrease in lipid body reserves was found in flies injected with live bacteria and, interestingly, this loss of body lipid also occurred in flies injected with heat-killed bacteria, but in a diet-dependent manner. Our results indicated that B. tryoni flies modulated their macronutrient intake and decreased the negative effects of the infection on their survival ("nutritional self-medication") the first days following the infection.