Answer
See the detailed answer below.
Work Step by Step
As the author told us, we need to find the force done by the spring in two cases.
First, when it stretched from A to B.
Second when it stretched from A to C, then back to B again.
Then we can prove whether the spring force is a conservative force or not. It will conservative force if the two works are equal and not if not.
We know that the spring force according to Hooke's law is given by
$$F=-kx$$
where $x$ is the stretched, or compressed, distance from the spring's equilibrium point.
$$W=\int F_{sp}dx$$
Thus, in the first case,
$$W_1=\int_{x_A}^{x_B} F_{sp}dx= \int_{x_A}^{x_B}-kxdx=-k\int_{x_A}^{x_B}xdx$$
$$W_1=-k\left[\dfrac{x^2}{2}\right|_{x_A}^{x_B} $$
$$W_1=\dfrac{-k}{2} \left[ x_B^2-x^2_A\right|\tag 1$$
And in the second case, we have two stages;
$$W_2=W_{A\rightarrow C}+W_{C\rightarrow B}$$
$$W_2=-k\int_{x_A}^{x_C} xdx+\left(-k\int_{x_C}^{x_B} xdx\right)$$
$$W_2=-k\left[\dfrac{x^2}{2}\right|_{x_A}^{x_C} -k\left[\dfrac{x^2}{2}\right|_{x_C}^{x_B} $$
$$W_2=\dfrac{-k}{2}\left( \left[ x_C^2-x^2_A\right]+\left[ x_B^2-x^2_C\right] \right)$$
$$W_2=\dfrac{-k}{2}\left( \color{red}{\bf\not} x_C^2-x^2_A + x_B^2-\color{red}{\bf\not} x^2_C \right)$$
$$W_2=\dfrac{-k}{2} \left[ x_B^2-x^2_A\right|\tag 2$$
And since the two works are equal no matter the path is taken from A to B, thus the spring force is a conservative force.