The influence of different nitrogen and potassium ratios on mineral nutrition and resistance of tomato plants to leafminer fly attack was evaluated. Tomato variety Alambra F1 was grown to conduct the experiment in a randomized block design, with 4 repetitions, in a 5 × 5 factorial scheme, being 5 doses of nitrogen and 5 doses of potassium at levels 0, 50, 100, 150, and 200% for each nutrient and in a 5 × 5 factorial design, being 0, 0.5, 1, 1.5, and 2 for each ratio between nitrogen and potassium (N/K) in the analyses on the leafminer fly. For infestation, the 3 rd or 4 th leaf was selected and covered with a Voile-type cloth bag with 10 leaf fly adults for 24 hours. The confinement test took place on the 3 rd or 4 th leaf, where nitrogen and potassium contents, larval and pupal duration and viability, longevity and sex ratio of the adults were also analyzed. The tomato plants showed increasing levels of nitrogen and potassium as their respective levels increased in the combinations studied. The N/K 1/1 ratio showed unfavorable averages for the insect as egg viability and/or larval development of Liriomyza sativae, indicating a possible induced resistance of the tomato plants to the leafminer fly.