Maximum entropy principle for self-gravitating perfect fluid in Lovelock gravity