While teaching how should I give justice equally to both female and male students? I am 27 years old unmarried male teacher. I have been a teacher (lecturer) for the last 6 months in an Engineering institution. My students are 4 to 5 years younger than me.

The problem is that while teaching I have soft corner towards female students. I don't understand whether it is due to opposite gender attraction or due  to female students asking more doubts than male students. I help  female students more than male students.  I know that it is against moral ethics of teacher's profession. But I couldn't change my attitude. Now, I think that male students might have noticed this and they may make complaints against me to the principal. 

So what changes can I make?
While teaching how should I give justice equally to both female and male students equally? Or should I quit teaching?
If you really can't change your actions, find a different profession.

You're aware of the issue - you admit you spend more time helping the females than the males.  Find a way to equalize that problem.  Be sure that you make your time available to all genders - use office hours, or clarify to all students how to get help from you.  Look for the patterns where you realize that you cut off help from the men and continued to help the women - there's like an unconscious bias that you may be able to over come with a pattern.

Changing a pattern like this may not be easy - but it's what's rightfully expected.

Also ponder - why - why do you give women more time?  Are you hoping for something more than a teacher/student relationship?  Is something more pleasing about them? What's causing the problem, and can you reduce the factors that lead up to it?

I suppose the other alternative is to find a place where you teach only one gender.  Then you don't treat your students unequally.  Personally, that seems like taking a short cut.