Hello, and welcome to Just Answer. My name is ***** ***** I will assist you with your question.
Anything is possible, but to do what you are thinking about doing, by the time you buy a engine
harnesses, PCM and spend many, many hours getting it to work with the components already in the truck, I just don't think that it is a cost effective way to fix the vehicle. I had a friend a couple years ago that changed a 1999 F-250 from a V-10 to a 7.3 diesel and it cost him almost $10,000 to do so. For a vehicle that the book value was only about $16,000 in excellent condition this was not a wise thing to do but he did it anyhow.
Since there is no diesel engine offered for your truck, that eliminates the possibility of a loaner wrecked vehicle to just remove what you need and swap it over. This would be total fabrication from the beginning.
In my professional opinion, I would not go this route. It would be cheaper to replace the existing engine with a reman and have a warranty.
If you need more information or have more questions, just respond and I will reply just as soon as I can.
Once again, thank you for using Just Answer and have a great day.