Black soldier fly larvae (Hermetia illucens; BSFL) can transform organic wastes into nutritional biomass useful in animal feeding. The aim of this work was to study the effect of five diets (meat, fruit, vegetable substrates, a mix of them and control) on the profile of fatty acids (FAs) and sterols of BSFL. For a more exhaustive characterization of the nutritional properties, the profile of esterified FAs in the sn-2 position of the triglycerides, the most absorbed lipid component during animal digestion was evaluated. The dietary effect was estimated on two different Hermetia illucens populations (Greek − UTH and Italian − UNIPI). The diet affected all the lipid fractions examined. Regardless of diet, the fat was characterized mainly of lauric acid and other saturated FAs, which were found to be synthesized by the larvae, as it was not present in any of the five substrates. In general, UTH larvae contained a higher level of lipids (7.38 vs 2.48 g/100 g of larvae; P < 0.001) and saturated FAs (49.71 vs 36.10 g/100 g of Total Lipids; P < 0.001) and a lower percentage of monounsaturated FAs (14.74 vs 26.70 g/100 g of Total Lipids), C18:3n-3 (0.67 vs 1.13 g/100 g of Total Lipids; P < 0.001), and C18:2c9t11 (2.02 vs 2.80 g/100 g of Total Lipids; P < 0.001). Irrespective of the populations, BSFL reared on control and fruit substrates showed higher level of lipids (8.06 and 5.61 g/100 g of larvae, respectively), and saturated FA (38.99 and 71.19 g/100 g of Total Lipids, respectively), while the presence of meat increased the level of C20:4n-6, C20:5n-3 and C22:5n-3 (0.70, 0.13 and 0.45 g/100 g of Total Lipids, respectively). The results confirmed that BSFL accumulate phytosterols in their lipid fraction. The sterol profile was strongly influenced by the substrate on which the larvae were reared, with higher levels of cholesterol in the larvae of the meat group (38.55 mg/100 g of Total Lipids) and of stigmasterol and campesterol (9.04 and 15.23 mg/100 g of Total Lipids, respectively) in those of the vegetable group. The sterol content between the two populations was significantly different, with a higher percentage in UTH larvae (113.28 vs 34.03 mg/100 g of Total Lipids; P < 0.001). Finally, BSFLs showed a high plasticity of the lipid profile depending on both the substrate and the metabolism linked to the different populations. This variability allows the nutritional characteristics of the BSFL to be shaped by modifying the substrate, to adapt it to the technological and feeding needs to which the larvae are destined.