Subwiki privacy issue

all users in main wiki are able to see subwiki content, How can prevent main wiki users to view subwiki content

By setting subwiki rights. By default, the subwiki does not have any right explicit set and inherit from main wiki, but you can decide to change it in the subwiki administration by assigning the rights to specific users (like subwiki XWikiAllGroup for example). The only thing you cannot do is prevent subwiki access for main wiki administrators.