We have $\vec F=\hat x(yz-2xy^2)+\hat y(axz-2x^2y+z)+\hat z(xy+y)$ and seek a scalar field $f$ such that $\nabla f=\vec F$.
Start with the $z$-component of $\vec F$. This component must be equal to $\frac{\partial f}{\partial z}$. Thus, we can write
$$\frac{\partial f}{\partial z}=xy+y\implies f=(xy+y)z+g(x,y)$$
Now, let's move to the $x$-component of $\vec F$. This component must be equal to $\frac{\partial f}{\partial x}$. Thus, we can write
$$\frac{\partial f}{\partial x}=yz+\frac{\partial g(x,y)}{\partial x}=yz-2xy^2\implies g(x,y)=-x^2y^2-xy+h(y)$$
And finally, we move to the $y$-component of $\vec F$. This component must be equal to $\frac{\partial f}{\partial y}$. Thus, we can write
$$\frac{\partial f}{\partial y}=xz+z-2x^2y+h'(y)=axz-2x^2y+z\implies a=1,\,\,\text{and}\,\,h(y)=C$$
Putting it all together, if
$$\bbox[5px,border:2px solid #C0A000]{a=1}$$
and
$$\bbox[5px,border:2px solid #C0A000]{f(x,y,z)=xyz+yz-x^2y^2+C}$$
then $\vec F$ is conservative with
$$\bbox[5px,border:2px solid #C0A000]{\vec F(x,y,z)=\nabla f(x,y,z)}$$