Interbank markets are fundamental for bank liquidity management. In this paper, we introduce a model of interbank trading with memory. Our model reproduces features of preferential trading patterns in the e-MID market recently empirically observed through the method of statistically validated networks. The memory mechanism is used to introduce a proxy of trust in the model. The key idea is that a lender, having lent many times to a borrower in the past, is more likely to lend to that borrower again in the future than to other borrowers, with which the lender has never (or has in- frequently) interacted. The core of the model depends on only one parameter representing the initial attractiveness of all the banks as borrowers. Model outcomes and real data are compared through a variety of measures that describe the structure and properties of trading networks, including number of statistically validated links, bidirectional links, and 3-motifs. Refinements of the pairing method are also proposed, in order to capture finite memory and reciprocity in the model. The model is implemented within the Mason framework in Java.