What's correct:
1) I worked hard to put my duties to a good use.
or
2) I worked hard in putting my duties to a good use.
They are both correct, but the meaning is different.
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.