$$2 (\frac{a^{2} + b^{2}}{ab}) + (\frac{a^{2} + b^{2}}{ab})^{2} - 2 = 2022$$
Now, let $\frac{a^{2} + b^{2}}{ab} = x$. The first equation would become,
$$x^{2} + 2x - 2024 = 0$$$$(x-44)(x+46) = 0$$So, $x = 44$ or $-46$. But, if we squared the second equation we get,
$$(\frac{a}{b}) + (\frac{b}{a}) + 2 = n$$$$\frac{a^{2} + b^{2}}{ab} + 2 = n$$Since $n$ is positive integers, $x = 44$, giving the answer $n = 46$.