Yes, you are allowed to leave Istanbul airport during layover in Istanbul as long as you will have a valid visa obtained
It is very simple process for certain country passport holders including US and Canada to get their e-visa in few clicks online; In order to see requirements and get it online, you can visit official website of Turkish Republic https://www.evisa.gov.tr/en/
Recommended minimum layover duration is 7 hours for travelers whose flights are connected and have their boarding pass with them. We can accommodate business travelers with shorter layover duration. To be on safe side, you may consider a tour when you will have plus 8 hour layover in Istanbul.
For international flights, if the luggages are checked through to final destination, and already have your boarding pass, you will be dropped off 2 hours prior to departing flight. For domestic flights, 1 hours is suffice.
You can use attended baggage storage or baggage storage lockers that are available 24 hours a day in Istanbul Airport. In case you want to bring it to the tour, please ask confirmation from tour operator prior to the tour date.