I have some files which are needed for the project, but they are service files which I have excluded from Git tracking using .gitignore, but I also wanted them not to be shown in the file list. Here is how I did it.
1. Go to Settings -> File types -> Ignore files and folders.
2. Add *.iml;*.egg-info; to field "Ignore files and folders".