The back of the motor is the same and will bolt right up but the engine mounting locations, oil pan profile, hose connections, cooling fan arrangement, etc may all present challenges. Should not be difficult by and large to work through those, but....
The 2.4L 6-cylinder bolts right in, runs smoother, makes more power, and is easier to get parts for.
What would be your reason for wanting to put the five in instead?
Interesting aside: for a few short years, from 1979 to 1981, Volvo in fact did produce and sell a small number of 200 series Diesels that were equipped from the factory with what they called the "D20" engine, which was the Volvo name for, that's right, the 2.0L Audi diesel inline five. Supposedly the cars were only sold in a few Nordic markets and were intended for urban taxi duty. There were evidently so few of them produced that my official Volvo parts catalog does not even include correct diagrams for the D20 engine -- all the D20 diagrams are just pictures of D24 parts, with the labels and part numbers and quantities altered as necessary. Many of the parts are shared of course, as far as consumables, moving parts, etc, but if you search a part number for a part that IS specific to the D20 engine (for instance P/N 1257644, the D20 oil pan), you'll find that the modern parts systems don't even lead to a reference for that part. Not "discontinued" -- just nothing there, no part found. Seems Volvo has forgotten these cars were ever produced! And maybe not on accident..... they must have been truly painful to drive....
I wonder if there is a single one of them left intact anywhere in the world.