Hint $ $ If false let $\:\!n\:\!$ be the $\rm\color{#0a0}{least}$ natural with $\,\color{#c00}{n^2 =3k-1}\,$ for some $\,k\in \Bbb Z.\,$ Clearly $\,n\neq \color{#90f}{0,1,2}\,$ thus $\,n\!-\!3\,$ is a $\rm\color{#0a0}{smaller}$ such natural by $\:\!(n\!-\!3)^2\! =\!\!\underbrace{\color{#c00}{n^2}-6n+9}_{\textstyle \color{#c00}3(\color{#c00}k-2n+3)\!\color{#c00}{-\!1}\!\!\!\!\!\!\!\!}\!\!,\,$ contra $\,n\,$ is the $\rm\color{#0a0}{least}$.
Note $ $ I avoided mod arithmetic since you wrote it is unknown. Above we used a form of induction known as Fermat's method of infinite descent, or minimal counterexample, or minimal criminal. $ $ If you study modular arithmetic then you can reformulate the above more simply as follows
$$\bmod \color{#c00}3\!:\ n\equiv \color{#90f}{0,1,2}\,\Rightarrow\, \color{#c00}{n^2}\equiv 0,1,1\not\equiv \color{#c00}{{-}1},\ \ {\rm so}\ \ \color{#c00}{n^2+1\neq 3k}\qquad\qquad$$