On the repeating sections, you would add conditional formatting to hide the section on the condition
count(preceding-sibling::my:repeatingGroupName) >= numberOfSectionsToShow
This will hide the extra sections. You'll also want to change the repeating sections' properties to prevent users from adding or removing rows.