UE5 how to make friendly AIs move to X location and takes spots around spot without picking same spot as another AI

not sure how you mean, it sounds like you are doing one query for all the AIs instead of one for each of them, sorry if I’m wrong in my understanding,
but could you not add a filter query that looks for AI and then filter out ones already occupied by another AI?
otherwise it sounds like you are trying to perform all these queries at the same and assign them the best spot for each ai? if so i would probably do this in c++ and perhaps create a array storing each AIs picks for positions and looping through to see if an ai has already chosen this.
the second method mentioned will be really complicated to achieve and will need to have c++ class that all ai have access to and can store the data locally in game. will take a lot of thinking and highly recommend using a activity diagram tool to map out your logic on that one as it will get messy quickly