Yes, you can think of keeping Mechanical Engineering as optional subject provided you have grip over the subject and understand the UPSC requirements.
We suggest you should have a look at the syllabus and previous years’ question papers to understand the requirements and the examiners’ expectations. As this is your own subject, you will be able to judge where you stand and how much effort is needed to match the exam-standards.
If not convinced with Mechanical Engineering, you can always think about any other subject even your choice Geography or Public Administration can be considered. These are very good optional subjects and very popular as well.
But, high score is no guarantee in any optional subject. For that, you have to prepare well and should understand the intricacies involved so that you can prepare your subject, satisfy the examiners with effective answers.
So, devote some time to search what suits you best and your selection need to be rational.