Grass Elymus elongatus has a potential in phytoremediation and was used in this study in a potted experiment, which was performed to determine the effect of polluting soil (Eutric Cambisol) with diesel oil (DO) and unleaded petroleum (P) on the diversity of soil microorganisms, activity of soil enzymes, physicochemical properties of soil, and on the resistance of Elymus elongatus to DO and P, which altogether allowed evaluating soil health. Both petroleum products were administered in doses of 0 and 7 cm3 kg−1 soil d.m. Vegetation of Elymus elongatus spanned for 105 days. Grasses were harvested three times, i.e., on day 45, 75, and 105 of the experiment. The study results demonstrated a stronger toxic effect of DO than of P on the growth and development of Elymus elongatus. Diesel oil caused greater changes in soil microbiome compared to unleaded petroleum. This hypothesis was additionally confirmed by Shannon and Simpson indices computed based on operational taxonomic unit (OTU) abundance, whose values were the lowest in the DO-polluted soil. Soil pollution with DO reduced the counts of all bacterial taxa and stimulated the activity of soil enzymes, whereas soil pollution with P diminished the diversity of bacteria only at the phylum, class, order, and family levels, but significantly suppressed the enzymatic activity. More polycyclic aromatic hydrocarbons (PAHs) were degraded in the soil polluted with P compared to DO, which may be attributed to the stimulating effect of Elymus elongatus on this process, as it grew better in the soil polluted with P than in that polluted with DO.