Якщо прийменник вживається між двома приголосними, або наступне слово починається з приголосного - варто вживати "У", якщо ж навпаки - то "В". Схоже на вживання "A" та "An" в англійській мові :)
If it stands between two consonants or the next word begins with a consonant, it's better to use "У" or vise versa. It's similar to the usage of "A" and "An" in English (AN apple, but A European)