Answer:
He should remove the doubt. He should try, as far as possible, to find out the correct and accurate number; otherwise, he should take the lowest number as his basis.
Sayyiduna Abu Sa’id al-Khudri (may Allah be pleased with him) narrates that the Messenger of Allah ﷺ said:
إِذَا شَكٌّ أَحَدُكُمْ فِي صَلَاتِهِ ، فَلَمْ يَدْرٍ كَمْ صَلَّى ثَلَاثًا أَمْ أَرْبَعًا ، فَلْيَطْرَح الشَّكَّ وَليَبْنِ عَلى مَا اسْتَيْقَنَ .
“If any of you has a doubt about the number of rak’ahs in his prayer, and does not know whether he has prayed three rak’ahs or four, he should remove the doubt and build on what he is certain of.”
Nawab Siddiq Hasan Khan (may Allah have mercy on him) (d. 1307 AH) writes:
الْأَقْرَبُ وَاللهُ أَعْلَمُ أَنَّ الطَّوَافَ يُوَافِقُ الصَّلاةَ فَمَنْ شَكٍّ هَلْ طَافَ سِتَّةَ أَشْوَاطٍ أَوْ سَبْعَةَ أَشْوَاطٍ فَلْيَطْرَحَ الشَّكَ وَلْيَتَحَرَّ الصَّوَابَ فَإِنْ أَمْكَنَهُ ذُلِكَ عَمَلَ عَلَيْهِ وَإِنْ لَّمْ يُمْكِنْهُ فَلْيَبْنِ عَلَى الْأَقَلّ كَمَا وَرَدَ بِذلِكَ الدَّلِيلُ الصَّحِيحُ .
The correct view is that tawaf is an act that corresponds to prayer. Therefore, whoever has a doubt about the number of circuits of tawaf, whether he has completed six circuits or seven, should remove the doubt and try to reach the correct and accurate number. If he succeeds in reaching the correct number, he should take it as his basis; otherwise, he should build on the lowest number, as is established by an authentic evidence.