In its entry on the (apocryphal) Epistle of Barnabas, the Anchor Yale Bible Dictionary states:
Although Barnabas 4:14 appears to quote Matt 22:14, it must remain an open question whether the Barnabas circle knew written gospels. Based on Koester’s analysis (1957:125–27, 157), it appears more likely that Barnabas stood in the living oral tradition used by the written gospels (Treat, J. C. (1992). Barnabas, Epistle of. In D. N. Freedman (Ed.), The Anchor Yale Bible Dictionary (Vol. 1, p. 614). New York: Doubleday).
The connection between Barnabas 4:14 and Matthew is, indeed, striking. Barnabas 4:14 states:
Moreover, consider this as well, my brothers: when you see that after such extraordinary signs and wonders were done in Israel, even then they were abandoned, let us be on guard lest we should be found to be, as it is written, “many called, but few chosen.” (Holmes, M. W. (1999). The Apostolic Fathers: Greek texts and English translations (Updated ed., p. 283). Grand Rapids, MI: Baker Books.)
If the last bit of this is a quotation from one of the Gospels, it can only be from Matthew 22:14, for this verse has no parallels in the other Gospels.
However, the idea that Barnabas is borrowing this from oral tradition is extremely implausible. The author introduces the quotation with the formula “as it is written”–not “as it is said.” This not only implies he is using a written source but also that he regarded it as scripture, for “it is written” is a standard formula for introducing scripture quotations.
The probability is thus that Barnabas was quoting Matthew’s Gospel, and that would let us establish a terminus ad quem (roughly, a latest possible date) for Matthew if we could establish when Barnabas was written.
It was clearly written after the destruction of the temple in A.D. 70, for Barnabas 16:3-5 refers to that event:
(3) Furthermore, again he says: “Behold, those who tore down this temple will build it themselves.” (4) This is happening now. For because they went to war, it was torn down by their enemies, and now the very servants of their enemies will re-build it. (5) Again, it was revealed that the city and the temple and the people of Israel were destined to be handed over. For the Scripture says: “And it will happen in the last days that the Lord will hand over the sheep of the pasture and the sheepfold and their watchtower to destruction.” And it happened just as the Lord said.
Precisely how long afterwards Barnabas was written is not clear, but it is certainly early. In fact, it is likely the first surviving piece of Christian literature written after the destruction of the temple. In The Fathers Know Best, I date it to around A.D. 75.
The fact that Barnabas records the destruction of the temple as a past fact (“And it happened just as the Lord said”) but Matthew presents it only as a future fact, with no notice of the prophecy’s fulfillment, suggests Matthew was written before 70.