Is the i5-6500 compatible with a z370p-d3 mb?

Solution
No. a i5 6500 is compatible with a z170 and z270 motherboard.

you want a i5 8400 with that motherboard which is a HEXAcore cpu whereas the i5 6500 is a quad core cpu.