The M50 I6 would be a long engine, couldn't find the measurement specs on it, so would be a tight squeeze length-wise.
And it looks fairly wide(and tall) as well with the intake setup.
You would need to use the BMW transmission with it, as a custom adapter plate would be expensive and the Ford 2.3l trans wouldn't last long with the extra power from the I6 in any case.
Custom drive line wouldn't be too expensive.
Windsor 351 V8 it about the largest engine that can be stuffed into the Ranger engine bay and it measures:
Length 27-1/2 Inches
Height 23-3/4 Inches
Width 21 Inches
I would see if you can find/get the M50's measurements