The former Beatle then asked the Foo Fighters star if they could showcase the track at the recent 12-12-12 concert in aid of victims of Superstorm Sandy, along with surviving Nirvana members Krist Novoselic and Pat Smear.
Dave told radio station KROQ that Macca is "just the sweetest, nicest, most awesome person."
He revealed he invited the veteran rocker to jam with him after they recorded some scenes for his new documentary Sound City.
Dave said: "We walked in; we jammed the song. It just came out of nowhere. The best songs happen that way. We recorded it live and put a vocal over it and that was it. It was three hours and it was perfect."
He added: "You have to understand, one of the great things about playing with Paul McCartney or playing with Neil Young is that that generation of musicians, they cherish and respect and value the practice of just going into a room and coming up with something and jamming and making it a song.
"There's not like seven songwriters and seven producers and digital technology or whatever. It's like people getting in a room."