Call pre_get_posts inside ajax

Not the way you’re doing it, no.

When the pre_get_post action is run any WP_Query queries run will be modified by the callback. Actions are not persistent, so when you run add_action() inside an AJAX callback that action is only going to be applied for that request, and you’re not running any queries in the AJAX response so there’s nothing to modify.

If you want to make an AJAX request that modifies all future queries then you need to save some record in the database in response to the AJAX request, and then inside your pre_get_posts callback you need to check for the existence of that record before conditionally applying the changes you want to make.

If you want to change all queries for the current user in response to an AJAX request then that becomes more complicated and you’ll likely need to use cookies.