$F \propto V^a \rho^b g^c$
$F=\left[L^3\right]^a\left[ ML ^{-3}\right]^b\left[ LT ^{-2}\right]^c$
$\left[ ML ^{-2}\right]=F=\left[ M ^{ b } L ^{3 a -3 b +c} T ^{-2 c}\right]$
On comparing.
$b=1,$
$-2 c=-2$
$\Rightarrow c=1$
$3 a-3 b+c=1$
$\Rightarrow 3 a-3+1=1$
$\Rightarrow 3 a-2=1$
$\Rightarrow 3 a=3 \Rightarrow a=1$
So, on putting all these values,
$F=V \rho g$