Here's what I found:
Bowie and John Lennon with Carlos Alomar- "John was hanging out. It was one of those hanging-out sessions so much a part of the '70s," Bowie told the News. "He said 'Hey, why don't we do something?' I said 'OK, you're on.' Then I (thought) 'Oh (damn), what do we do? How do you write something with a Beatle?'"
Bowie guitarist Carlos Alomar had come up with a riff they'd been doing in a cover of the old '50s Flares tune, Foot Stomping.
"We immediately started doing that. John was just playing along with it, and every now and again he'd go 'AYYMM!!' And I said 'I got it, I got it!' And I just put an F in front of it Fame! We were off and running from there."
Lennon wrote the chords, Alomar the roaring guitar line and Bowie filled in the lyrics and the lower guitar parts.
"I really wish, obviously, in hindsight that we'd done more work together. It was such a joy being in the studio with him. I wonder what we would have done," he said. "But we were having too much of a laugh. Most of the time we spent together was pure stupidity. There wasn't much work going on at all, as you can imagine."
and
MUSICIAN: How did the Fame session with John Lennon for the 1975 Young Americans LP come about?
BOWIE: After meeting in some New York club, we'd spent quite a few nights talking and getting to know each other before we'd even gotten into the studio. That period in my life is none too clear, a lot of it is really blurry, but we spent endless hours talking about fame, and what it's like not having a life of your own any more. How much you want to be known before you are, and then when you are, how much you want the reverse: "I don't want to do these interviews! I don't want to have these photographs taken!" We wondered how that slow change takes place, and why it isn't everything it should have been.
I guess it was inevitable that the subject matter of the song would be about the subject matter of those conversations. God, that session was fast. That was an evening's work! While John and Carlos Alomar were sketching out the guitar stuff in the studio, I was starting to work out the lyric in the control room. I was so excited about John, and he loved working with my band because they were playing old soul tracks and Stax things. John was so up, had so much energy; it must have been so exciting to always be around him.