Both are correct and acceptable and, some cases, there may be subtle difference in meaning depending on where the 'not' is placed.
The more usual construction is 'try not to', and that's the one I'd recommend you use - especially in grammar tests. It is not incorrect to say 'to not try', but a narrow-minded teacher might mark it wrong.