No: "can" is present tense
The "can" in "can cast" must refer to at the time of the casting. It is in the present tense. It doesn't mean you could cast it after you've gained another level and select it as a new known spell, or that you will be able to cast it once you get your hands on a magic item that allows you to do so: you must be able to cast it at the time you cast Contingency. With that in mind, consider these two problems.
1.) As Mark Wells pointed out, Wish doesn't "cast" a lower level spell: it creates its effects. So Otiluke's Resilient Sphere isn't a "spell you can cast", it's a spell you can emulate. This is similar to the way that a fighter who could drink a Potion of Heroism could be under the effects of the Bless spell, but can't cast Bless.
2.) Even if Wish DID cast the lower level spell (which it doesn't), you wouldn't be able to cast Otiluke's Resilient Sphere without casting Wish again. And to do that, you'd need a second 9th level spell slot, since you're already spending one on creating the effects of Contingency (via Wish). A 17th level sorcerer has only one 9th level spell slot per day (and can't create more with sorcery points). So at the time of casting Contingency, Otiluke's Resilient Sphere isn't a spell you "can" cast.
An argument could be made that you also can't do what you propose because Wish is a 9th level spell, and Contingency can only line up a spell 5th level or lower. But that argument is complicated by the precise wording of Contingency, so I'll leave it alone for now. Regardless, these two reason (especially the first one) are barrier enough.