1) I worked hard to put my duties to a good use.
2) I worked hard in putting my duties to a good use.
Both look correct to me.
I work hard in putting my duties to good use.
I work hard in my area of work which is 'putting my duties to good use'.
not a teacher
But they are not the best sentences to exemplify the grammatical point. If something is your duty, you do it; you don't put a duty to use.
Let me change 'duties' to 'talents' in order to explain.
1) I worked hard to put my talents to a good use.
2) I worked hard in putting my talents to a good use.
1. This means that you put an effort into ensuring that your talents were used. The hard work was in making your talents work for the job in hand which might have actually required different talents.
2. This simply means that you worked hard using your talents. You made no extra effort to assure that your talents were used. That came automatically because the job required them.