The L298N module typically has a terminal marked +5V (shown as logic supply 5V on the attached diagram).
As long as you do not connect this terminal to the Pi you will be fine.
I am not going to speculate further without a clear photo of the module you are using.
The L298N module derives its logic supply power from the attached battery/power supply or the connected Raspberry Pi.
If the attached battery/power supply is 5V or more connect the logic power jumper (pink) and do not connect between the Raspberry Pi and logic supply 5V.
If the attached battery/power supply is less than 5V do not connect the logic power jumper (pink) and do make a connection between the Raspberry Pi and logic supply 5V.