I guess this is not easy in general.
Let me give an answer for $N=4$, under the condition that $C$ has only isolated ordinary double points.
Then there is the following result.
Theorem. Let $C \subset \mathbb{P}^4$ be a hypersurface of degree $d$ with at most ordinary double points as singularity. Let $\Sigma:=\textrm{Sing}(C)$. Then the following are equivalent:
- every divisor on the threefold $C$ is Cartier;
- every surface $S \subset C$ is cut out on $C$ by an hypersurface in $\mathbb{P}^4;$
- the set $\Sigma$ imposes independent linear conditions on forms of degree $2d-5$.
In other words, $C$ is factorial if and only if
$$H^1(\mathcal{O}_{\mathbb{P}^4}(2d-5) \otimes \mathcal{I}_{\Sigma})=0. \quad (\star)$$
If you have an explicit equation for $C$, you can easily check condition $(\star)$ by using Macauley2.
Ivan. Cheltsov showed that that if $|\Sigma| <(d-1)^2$ then $C$ is factorial. This is not true if $|\Sigma|=(d-1)^2$: in fact, an hypersurface of the form
$$x_0F+x_1G=0,$$
with $F$ and $G$ general linear forms of degree $d-1$, is not factorial since it contains the $2$-plane $x_o=x_1=0$: notice that there are $(d-1)^2$ nodes on this plane.