If you want your apple tree to grow apples, you need bees to pollinate the flowers. If the tree is just ornamental and you don't care about growing apples, there are ways to avoid attracting bees. If your problem is with insects that come around when apples are on the branches, the insects are probably yellow jackets, a type of wasp, not bees. Yellow jackets are attracted to the sweet smell of fruit.
A commercial product available in garden stores, growth regulator, interferes with the normal cycle of the apple tree. Spray it on buds or early flowers in the spring, and the scent that normally attracts bees will not be present. You will also not get any apples on that tree.
Make it Smell Bad
Bees and yellow jackets are attracted to sweet smells. Spray products on the tree that don't smell good to them. One of the most common is vinegar mixed with a little water. Fabric softener sheets can be hung in the tree to repel insects. Some people use cayenne pepper, but remember, it is very irritating to wild animals, pets, and you as well. Traps are also available that kill bothersome insects.