How do I display entries in the top menu based on conditions selected in the sidebar menu?

If you have 3 templates, you can use the conditional check is_page_template to check which one is currently in use.

See https://developer.wordpress.org/reference/functions/is_page_template/

Or if you weren’t talking about page templates, but rather a specific archive template, you can get the current term id with get_queried_object_id.

See https://developer.wordpress.org/reference/functions/get_queried_object_id/

Then, you could register 3 different menu locations and make an if statement to choose between them when outputting the menu in the header file.