Welcome to the forum!
I have to say, that I really like the thought of what you're planning. If there's room to physically fit the motor, and it turns the right direction, and shaft driven. I can't see why it wouldn't work. It would likely be a project requiring fabrication skills, as well as tools & equipment. Not to mention, a place to do this. If you've got all of that, then I'd say yes, it would work. It all starts by measuring the motor, and then measuring the space where it'll go, with the bed down. Of course the bed could be raised if it comes to that. But I really don't see it saving any money, if that's a big part of your plan. Having someone who does this type of work doing it, might be a better call. Assuming that it's diesel power that you're after, rather than just a quick easy swap.
Rebuilding the old motor, would be much easier, and probably much cheaper in the end, with lots of well worn paths of experts, and professionals, manuals, parts and such. With the swap, you're pretty much on your own, creating as you go. If you're thinking that it'd be a toss up, on which way to go...not even close. It has the potential to be a full on project. While there is a small chance that it'll just practically hop in there, with little modification, but probably not. Then of course there's the wiring to deal with. To do this right, and have it be something that you're proud of, and show off to friends. You'll have to be over the top with welding, and fabrication, wire management, paint etc. If you do decide to fit the diesel engine, it has a lot of potential. The bragging rights alone would be priceless.
I know which way I'd go, even though, like yourself, I'd be mighty tempted. I'm sure the diesel motor could be sold to finance a lot of the project, while at the same time, freeing up some space. Regardless of which way you decide to go, remember to please keep us updated with pictures. Good luck with your project whichever direction you choose!