How to personalize accuracy metrics in fastai library

Hello all,
I have 2 questions with my own user case of classification problem:

First question: I want to ask how to personalize the accuracy metrics in classification problem in For instance, i want to calculate the top 3 accuracy during training for validation set. How can I do that?

another question: when i use fastai library in my user case, i got a good results on accuracy of validation (98%) as well as top 3 error on my validation set (0.05). But when i predict on test set, i had a very bad accuracy with top 3 error is 0.8. And the thing when i build myself the model (same model as i used with fastai library, and same dataset split) from scratch, i got the same top 3 error in test set as validation set (0.05). It means that there are something wrong with my builing fastai but i don’t really know why.

Thanks in advance.