How to connect a fast recovery diode with 3 pins?
That diode has four pins.

You connect it as shown in the diagram in the datasheet:



Pin 1 is not connected (NC) electrically.  Place a pad to mount it.  It is only there for mechanical purposes.

Pin 2 is a stub.  You cannot place a pad for it.  It is electrically connected to pin 4 (the large tab on the back of the part.)

Pin 3 is the anode.  It goes to the switch in your circuit.

Pin 4 is the tab on the back.  It is the cathode.  You connect it to the power supply in your circuit.