While you ask how to tell if an entry is a file or a folder, that is not what you actually need to solve the problem you describe:
Unless I misunderstand your post, you want to extract the contents of the archive without adding an extra folder if and only if all the contents of the archive is within a single folder (possibly with subfolders within that folder). The question then is not whether individual entries are folders or files, but whether every single entry shares the same initial path. Folders may or may not be stored explicitly in an archive (for instance, either can be the case in a ZIP archive), so except for the case of only a single empty folder within an archive - which I would hazard is not an important case - the absence or presence of a folder entry is not important.
Only when there is only a single entry in the archive will there be any ambiguity, namely whether that is a file or a folder. In that situation, you might even choose to do without the additional folder even if it is a file.