The growing demand for energy, coupled with volatile oil prices and the environmental damage caused by the harmful gases produced when it is used, has prompted countries to explore alternative energy sources. The transportation sector, an important end-user of petroleum, must adapt to the changing energy landscape and opt for new technologies to remain competitive. The study conducted a thorough thermodynamic analysis to assess the economic and environmental impact of using biodiesel (BD) made from cold-pressed linseed crude oil, commercial diesel fuel (DF), and ethanol in a compression-ignition (CI) engine. The study conducted a detailed thermodynamic analysis of performance and emission data recorded from a single-cylinder diesel engine. The analysis included energy, exergy, sustainability, exergoeconomic, exergoenvironmental, and exergoenviroeconomic parameters. The results pointed out that the fuel energy increases with the load, with B20E5 fuel reaching 6.887 kW at 25% load and 18.908 kW at 75% load. BD and blended fuels were found to have a higher fuel energy compared to DF. At 50% load, DF and B20 fuels have fuel energies of 10.765 kW and 10.888 kW, respectively. The analysis clearly demonstrates that commercial DF outperforms both DF-BD binary fuel blends and DF-BD-ethanol blends in terms of thermal and exergy efficiency values. Furthermore, DF exhibits lower entropy generation and exergy destruction than other binary and ternary blends. At maximum load, the exergy efficiencies of DF, B20, and B20E10 fuels were 28.5%, 25.8%, and 24.7%, respectively. The exergy losses were determined to be 10.495 kW, 12.317 kW, and 13.134 kW, respectively, under the same conditions. Binary and ternary fuel blends have a higher cost of power from the engine shaft due to the expensive market prices of ethanol and linseed oil-based BD compared to DF. However, B20 and B20E10 fuels have a lower environmental cost than DF, with B20 and B20E10 fuels estimated to be 2.8% and 5.3% lower than DF, respectively, at full load. These findings demonstrate the clear advantages of using B20 and B20E10 fuels over DF, both in terms of cost and environmental impact. Additionally, the infusion of ethanol into ternary blends reduces the environmental damage. This study provides a unique perspective on sustainable energy research and serves as a valuable reference for future studies.