Summary - it's likely a mixture of op-amp weaknesses, differential resistor mismatches and, possibly ripple artefacts from C6.
The problem is that current measurement is working only when mosfet is
fully on.
Yes, that makes sense. That should be OK.
When I start switching, op amp outputs approximately 800 mV. I have no
idea what is wrong.
At 300 kHz to 350 kHz switching, your AS321 op-amp is basically close to useless as a precision measurement asset: -

It has an open loop gain of around 7 dB and this is nowhere near high enough to resolve the peak current taken during the period where the MOSFET is conducting. But there's other problems...
Differential resistor mismatches
When the MOSFET is fully on, the voltage at \$OUT-\$ is down at GND volts and, that's fine because any slight/tiny mismatch in the differential amplifier resistors will not cause a significant error. However, when the MOSFET is switching and the \$OUT-\$ node is up at (say) 20 volts, there will be a significant error caused by even the slightest mismatch between R15, R16, R17 and R18. This is a very common problem with differential amplifier circuits of this type.
To verify this, what you can do is apply an external DC voltage onto \$OUT-\$ (MOSFET inactive). Vary that applied voltage from 0 to 20 volts and note how the op-amp output also varies.
Even a 0.1% difference between those resistors could produce a significant error voltage on the op-amp output as the voltage applied to \$OUT-\$ rises up to 20 volts. Here's a simulation showing the scenario of no load current and the voltage changing at node \$OUT-\$ (I call it CM voltage below because that's the better phrase to use). The op-amp is ideal so no errors from that bad-boy: -

The above simulation used 1% tolerance resistors in their worst-case positions and extremes.
Possible ripple voltage problems
The 470 μF capacitor (C6) that is intended to smooth the voltage across the LEDs will have an internal ESR (effective series resistance) of maybe 0.5 &ohm and this will produce a significant ripple voltage on both measurement limbs of the differential amplifier. And, it's quite possible that this ripple voltage (at 300 kHz to 350 kHz) is larger than the intended voltage measurement across the shunt resistor - this ripple is also subject to the problems mentioned earlier of resistor tolerances and may induce a further error.