Onions need to dry, or "cure," if you are planning to store them for later use. Rather than washing the dirt off with water, spread the onions out in an area with good air circulation. A window screen set up on blocks is a good option, as it allows air to circulate all around the onions. Spread the onions in a single layer and cure in a warm, airy place for a week or two.
You'll know the onions are dry enough for storage when the tops have completely dried. Simply snip off the dried tops and any clinging roots. The dirt will have dried as well and can be rubbed or brushed off at that point. Leave the outer skins on, as they will protect the onions during storage; remove them just before use. Place the dried onions in mesh onion bags and store in a cool, dark place. For more information read: Growing Onions in the Home Garden
Keep in mind that only onion varieties recommended for long storage will keep well. Sweet varieties of onions are better eaten fresh and won't store well.