You wouldn’t. The N-Queens problem is easily solved by hand for N up to 11. Above that you would use simple back-tracking.
Knowing the right tool for each job is an essential part of learning to program. You shouldn’t use a saw to turn a ***** or a hammer to drill a hole, and you shouldn’t use AI for simple combinatorial problems.