We extend ideas developed for the loop representation of quantum gravity to diffeomorphism-invariant gauge theories coupled to fermions. Let P→Σ be a principal G-bundle over space and let F be a vector bundle associated to P whose fiber is a sum of continuous unitary irreducible representations of the compact connected gauge group G, each representation appearing together with its dual. We consider theories whose classical configuration space is A×F, where A is the space of connections on P and F is the space of sections of F, regarded as a collection of Grassmann-valued fermionic fields. We construct the “quantum configuration space” Ā×F̄ as a completion of A×F. Using this, we construct a Hilbert space L2(Ā×F̄) for the quantum theory on which all automorphisms of P act as unitary operators, and determine an explicit “spin network basis” of the subspace L2((Ā×F̄)/Ḡ) consisting of gauge-invariant states. We represent observables constructed from holonomies of the connection along paths together with fermionic fields and their conjugate momenta as operators on L2((Ā×F̄)/Ḡ). We also construct a Hilbert space Hdiff of diffeomorphism-invariant states using the group averaging procedure of Ashtekar, Lewandowski, Marolf, Mourão and Thiemann.