The aim of the research was to determine the effect of soil contamination with diesel oil (0; 5; 10 and 15 cm3 kg−1 of soil) on the content of trace elements in the aboveground parts of oat (Avena sativa L.). Stabilised sewage sludge was used to mitigate the likely negative impact of diesel oil on the plant. Growing soil contamination with diesel oil had a significant impact on the content of trace elements in the aboveground biomass of oat. In the series without sewage sludge, the contents of the analysed elements, except for chromium, zinc, copper and cobalt, were positively correlated with the increasing doses of diesel oil. The largest increase in the content was recorded in the case of manganese. The sewage sludge used to reduce the influence of diesel oil on the chemical composition of oat had a positive effect on the content of the analysed trace elements. Compared to the series without the addition of a stabilised sewage sludge, it contributed to a reduction in the average content of chromium, nickel, copper, manganese and cobalt in the aboveground parts of oat plants. No significant effect of the applied remediation treatment was noted for cadmium, and the results were equivocal for iron.