There are two seasons for Alaska the Shoulder Season and Peak Season. Shoulder Season is May, the first week of June, the last week of August and all of September. Peak Season is most of June, July and August.
Peak Season tends to cost more because the weather is better and that is when more people can travel. The This is the most likely time for families to take cruises, etc. More people are able to go and more people can go, so prices are higher. During shoulder season you will be able to save some money because the cruise lines are trying to get more people on board. Both seasons are great and just as beautiful as the next. You go at different times and it just a different type of beauty.
As far as when to go anytime between May and September is good. Obviously to save money you would be better going during shoulder season. Spring is absolutely beautiful because all the flowers are blooming, but Fall is also a great time because of the foliage.
If you go in June and July you will have the warmest weather and the longest days. So really, all the months have good points for why you would want to go, so you can pretty much schedule when you are available to go.
If you can, try to do an inside passage cruise. This is my favorite way to go. You will go to more ports this way and see a lot more. There are also cruises where they include a tour at each port, which is a really fun way to go, especially for your first visit. You will learn and see a lot by taking the cruise.