Ultra-processed foods have been associated with several negative outcomes, but it is not clear whether they are related to bullying perpetration. Moreover, no previous study has investigated the potential role of deviant behaviors as a mediator of this association. Our objective was to evaluate the association between ultra-processed dietary pattern and bullying, and the mediating effect of deviant behaviors in this association, among school adolescents. We used data from a representative sample of 9th grade Brazilian adolescents (N = 2,212) from the São Paulo Project for the social development of children and adolescents (SP-PROSO). Exploratory factor analysis was used to obtain the dietary patterns, through questions of frequency of consumption in the last week of several foods. The ultra-processed dietary pattern was considered as exposure. The outcomes were the types of bullying (any type, social exclusion, psychological/verbal aggression, physical aggression, property destruction, and sexual harassment). Deviant behaviors (mediator) were assessed through a score. Mediation analyses were carried out using logistic regression based on the KHB method. After adjusting for covariates, the mediating effect of deviant behaviors was found in the association between ultra-processed dietary pattern and all the types of bullying perpetration, especially for psychological/verbal aggression (39.4%). A small mediating effect of deviant behaviors in the association of ultra-processed dietary pattern with physical aggression (17.7%) and property destruction (18.5%) was observed, but this effect explained only a small portion of the total effect of such association (significant direct effect). The ultra-processed dietary pattern was associated with bullying, and the association was mediated through deviant behaviors. Policies and actions for improving the adolescent's diet and managing the adoption of deviant and bullying behaviors by this public are required.