https://pokemondb.net/pokebase/428278/does-the-ai-make-different-decisions-when-it-knows-held-items
Ngl, every time I play the Battle Tree in Ultra Sun and run into a Pokemon with Frisk, I think about this question lol. The worst part about it is that the Pokemon that have Frisk ends up seeing that I have non that useful for the question items like Salamencite xd.
Who knows, maybe I might try to figure it out for Gen 7 as I do ULTRA stamps runs for the Battle Tree. I could try to find out the behavior of AI in Gen 6 when it knows your held item if I could be bothered to actually get myself to play the Maison in ORAS lol
Sadly I don't have a Gen 5 cartridge game to test xd