Get a new working copy of the project. See Retrieve a Working Copy of a Project from Source Control.
To avoid accidentally committing changes to your project meant only for the template, stop using source control with this sandbox as you work on the template. In the Source Control view, under Available Source Control Integrations, select No Source Control Integration and click Reload.
Remove the files that you do not want in the template. For example, you might want to reuse only the utility functions, startup and shutdown scripts, and labels. In the Project Files view, right-click unwanted files and select Remove from Project.
On the Simulink Project tab, in the File section, select Share > Template and use the dialog box to name and save the file.
To verify that your template behaves as you expect, create a new project that uses your new template. See Create a New Project Using Templates.