Let $N = am - bn^2$ where $a, m, b$ are given and all are positive integers. We need to choose $n$ such that $N$ has smooth factors $d_i$ (where $d_i \le \beta$).
How can we accomplish that?
Right now, I am just brute-forcing it. Is there a better way?
Your problem is equivalent to the sieve step of the quadratic sieve method for factoring large numbers. Here is the relevant section from Wikipedia:
In your case, $f(x) = am-bx^2$. This is not exactly in the form $f(x)=x^2-n$ used in the article, but the method is the same. Also, it is not explicitly mentioned in the article, but for higher powers of each prime $p\le\beta$ you can use Hensel lifting (e.g. see this question) to solve the quadratic congruence mod $p^k$, and you would need to add a total of $k\log(p)$ to each entry of $A$[] that solves the congruence mod $p^k$.