This question is very simple and hardly involves the issue of energy conservation.
First of all, the energy of the water flow must be incredibly large under normal circumstances. Even if you can use a small part of it to convert it into boat power, that's enough.
For example, build a hydroelectric plant on the shore... then use enough electricity to sail the boat against the current. This method is entirely consistent with the idea that electrical energy comes from current. the energy of the water flow.
If you mean that all this is done on a ship that is not docked, I personally think that is simply impossible! Because a boat flowing with the current without docking is relative to the shore, this means that the boat and the water current are relatively stationary and have no change in energy. Can you imagine using the energy ofe the rotation of the Earth? This one has greater energy.
...I like people who have random thoughts, because me too haha.