Assuming the tank is in good condition & has quite flexible sides ....
? Empty tank 'til 2-4 litres left, rub sides against each other vigourously. Empty sludge, partial refill, repeat. Repeat cycle until water
comes out clear.
A drill mounted centrifugal pump can help do this sort of stuff if you have manual pumps (like mine) on your boat.
? Or, flexible tanks
and easy to replace if you can buy the right size. A more expensive but good option if tanks are suspect in any way?
Then use (non-bleach, non-caustic) water
treatment tabs to keep the tank clean. Bleach and other astringent chemicals will kill plastic ...
Good luck ... all frustrating jobs are rewarded by the pleasures of sailing.