Direction of N-channel mosfet when replacing the diode in the buck convertor
The first diagram is correct.
The FET body diode will conduct during the PFET  off cycle and the NFET being turned on bypasses this diode, reducing the voltage drop below what a diode alone can provide.
In the second diagram the NFET body diode would conduct whenever the PFET was turned on, providing a nearly hard short circuit to earth