Based on a hadith that the Prophet (s.a.w.s.) narrated, it is permissible for one to say in his or her dua that “O Allah, if I am sincere in this action of mine then make me succeed, or make it perfect for me.” (islamqa.info)
This is proven by a hadith mentioned in Sahih Bulhari. Te story is about three men who got trapped in a cave and each of them mentioned a good action of theirs and asked Allah for help by virtue of their righteous deeds, and each of them said in his du’aa’: O Allah, if You know that I did that seeking Your Countenance, then grant us relief. As a result, Allah answered their dua. The following is the full story and hadith:
It was narrated that ‘Abd-Allaah ibn ‘Umar said: The Messenger of Allaah (blessings and peace of Allah be upon him)) said:
“Whilst three men were walking, it began to rain, and they found shelter in a cave in a mountain. Then a rock from the mountain fell over the mouth of the cave, and they were trapped. They said to one another: See if you have done any righteous deeds for the sake of Allah, and pray to Allah by virtue thereof so that He might remove the rock for you.
One of them said: O Allah, I had my parents who were old and my wife, and I had young children. I used to graze the sheep for them and when I come back in the evening, I used to milk (the sheep) and I would start with my parents, and give them to drink before my children. One day I was delayed and I did not come back until evening, and I found that they had gone to sleep. I milked (the sheep) as usual, then I brought the milk and stood by their heads, but I did not like to wake them from their sleep, and I did not like to give milk to the children before them. The children were crying at my feet, and I remained like that and they remained like that until dawn came. If You know that I did that seeking thereby Your Countenance, then open it a little for us, so that we may see the sky. Then Allah opened it a little for them, and they could see the sky.
The next one said: O Allah, I had a female cousin whom I loved as deeply as any man loves a woman, and I wanted to have my way with her, but she refused unless I brought her one hundred dinars. I worked hard and collected one hundred dinars, and brought that to her. But when I was between her legs, she said: O slave of Allah, fear Allah and do not break the seal except in a lawful manner. So I got up and left her. If You know that I did that seeking thereby Your Countenance, then open it some more for us. And He opened it some more for them.
The last one said: O Allah, I hired a man in return for a measure (faraq) of rice, and when he had finished his work he said: Give me my wages. I offered the measure of rice to him but he refused it. So I sowed the rice many times until I had acquired cows and a herdsman thereby. Then he came to me and said: Fear Allah and do not wrong me with regard to my wages. I said: Go to these cows and their herdsman and take them. He said: Fear Allah and do not make fun of me. I said: I am not making fun of you. Take the cows and herdsman. So he took them and went away. If You know that I did that seeking thereby Your Countenance, then open the rest of it for us. So Allah opened the rest of it. (and they were freed from the cave)”
Narrated by al-Bukhaari (2272) and Muslim (2734).