Anything is possible if you have enough money to throw at the project, but at some point, each project begins to cost more than it will ever be worth.
The real mystery, though, is how you came by a petrol-powered BT-50. In Australia, the BT-50 was sold only with a range of diesel powerplants. Petrol-powered BT-50s were made and sold in regions such as the Americas, South Africa and parts of Asia, but not here. Either that or you have a Mazda fitted with a Ford Ranger engine, as Ford did offer 2.5-litre petrol engine on Rangers from 2011 to 2015, but only on base-model, two-wheel-drive versions. That option was then discontinued.
So maybe you have a privately imported Mazda, at which point, it’s very hard to know what diesel engines will and won’t fit. The bottom line is that if you want a Mazda BT-50 with a diesel engine, the simplest thing to do is simply buy one. Chances are you’ll spend less overall than converting an existing car from petrol to diesel. Swapping a petrol engine for a diesel could involve everything from a different fuel system, wiring, transmission, differential ratios and even things like the radiator and front springs. It’s a big job.