The contingency spell requires that you "can cast" the contingent spell (of fifth level or lower).
A Ring of Spell Storing lets you store up to a single 5th-level spell by any caster (for example, a death ward cast by a friendly cleric) and later be able to cast it yourself (using the initial caster's modifier/DC if applicable) even if it's not normally on your list.
If you have a spell that you don't normally know inside your Ring of Spell Storing, can you then choose it as the contingent spell for contingency?