It won't be a direct fit, but it can be modified to work.
The biggest difference will be the diameter of the crankshaft where the electric PTO clutch goes. The JD spec P218 has a 1-7/16" diameter shaft while the Ingersoll spec P218 has an 1-1/8" shaft. I had a local machine shop turn one down for me a few years ago. He said he's done some other small engine crankshafts while the engine was still assembled (sat the whole thing in his lathe), but said it would be easier with the crank out ... and I wanted to disassemble the engine to inspect the internals anyway so that was no big deal.
Another difference is the starter. The JD P218's use a starter that has the solenoid clocked so it's down under the starter motor. While the Ingersoll P218's use a starter that has the solenoid clocked so it's off to the side of the starter motor. I think the bottom facing solenoid might hit (or be really close to hitting) the frame on an Ingersoll so it would be best to swap to the starter with the side facing solenoid.
The muffler used in JD tractors like the 318 & 420 is very similar to the one used in Onan powered Ingersoll 3xxx/4xxx series tractors. Only difference is the JD outlet pipe points straight out the side while the Ingersoll one has a 90 degree elbow to point it forward through the opening in the hood.
Probably a few other little differences too, but those are the major ones I'm aware of.