By the Chinese Remainder Theorem, we can reduce to the following cases:
- $N$ is coprime with $6$
- $N$ is a power of $3$
- $N$ is a power of $2$
Suppose that $N$ is coprime with $6$ and that $-3$ is a square mod $N$, say $\rho^2=-3\pmod{N}$. Put $\omega=(-1+\rho)/2$ so $\omega^2=\omega^{-1}=-1-\omega=(-1-\rho)/2$ in $\mathbb{Z}/N$. Put \begin{align*} X &= (U+V+W)/3 \\ Y &= (U+\omega V+\omega^2W)/3 \\ Z &= (U+\omega^2V+\omega W)/3 \end{align*} Then your equation becomes $UVW=1\pmod{N}$, so you can take $U$ and $V$ to be arbitrary numbers that are coprime to $N$, and $W=1/(UV)\pmod{N}$.
I have not worked out what happens if $N$ is coprime with $6$ but $-3$ is not a square mod $N$.
For the other two cases, experiment suggests the following. Suppose that $N=p^m$ with $p\in\{2,3\}$ and $m\geq 2$. Suppose that $X,Y\in\mathbb{Z}/N$ are given, with $X=Y=0\pmod{p}$. If $p=2$, then there is a unique $Z\in\mathbb{Z}/N$ with $f(X,Y,Z)=1$. If $p=3$, there are instead $3$ choices for $Z$. In either case, we always have $Z=1\pmod{p}$. We can also permute these solutions cyclically, which gives another factor of $3$. If $p=2$ this gives $3.2^{2m-2}$ solutions in total, and if $p=3$ then the number is $3^{2m}$. All this should be provable by a kind of Newton-Raphson iteration, but I have not worked out the details.