will a 318 out of a 1970 plymouth fit into a 1987 dodge dakota

It will fit in the engine compartment. It may however be cost prohibitive to do this swap.
What motor is currently in the Dakota?
Automatic or Manual?

You might want to post on this site. There a lot of knowledgeable Dakota people here.

Off the top of my head the only V8 offered in a Gen I Dakota (87 - 91) was in the Shelby Dakota conversion. To fit a V8, Shelby had to use an electric radiator fan instead of a mechanical one. The Gen II Dakotas (92 - 96) abd later had a longer engine compartment to fit a factory V8 (318). I had a 95 with a V6 and there was plenty of room for the engine.

Ed B.