I believe we've been through this before and was solved with a 4S9706 T1210 turbo for the D339. Old post price was $1050 plus $325 core charge.
I had a 17A that the turbo went bad on and could not find parts for.Wound up adapting a used one from a D6C to fit,worked fine.
If you don't think you could "swing" a complete engine swap, you might consider swapping the head and turbocharger etc off your tractor with the worn out undercarriage over to the one with the good under carriage. Pull the bad one off first and look at the cylinder wear to see if perhaps a complete engine swap would be better. Good undercarriage for 5000 would be pretty hard to beat plus no installation.
I'd guess an engine swap would be easier than an undercarriage swap, if all the necessary parts are in hand between the two machines.