Arguably the most charming drunk scene in the history of cinema comes halfway through the 1960 classic “The Apartment.” C.C. Baxter, the junior executive played by Jack Lemmon, has just discovered — on Christmas Eve, no less — that the elevator operator he pines for is the mistress of his married rotter of a boss. Heartbroken, he retires to a Manhattan bar and proceeds to get purposefully plastered. But he does so with style and with a bowler on his head. Martinis are his embalming fluid of choice, and he keeps count of them (13!) by arranging the olive toothpicks on the bar in the shape of an ever-growing star.

One thought you take away from such a scene is: Either the screenwriter or the director of that scene likes drinking a lot and thinks drinking can be fun, funny, and sophisticated. And you’d be right on both counts. For the writer and director of “The Apartment” are the same man, Billy Wilder. And, perhaps more than any film director in history, Wilder had a liking for cocktails and translated that affection to the screen.

In Wilder’s first assignment as a Hollywood writer director, “The Major and the Minor” in 1942, he whisked humorist Robert Benchley behind a home bar to utter the immortal line, “Let’s get you out of these wet clothes and into a dry Martini.” (Who came up with the quip remains a matter of dispute. Wilder and his screenwriter partner Charles Brackett put the line in the script because they thought Benchley coined it, but Benchley denied authorship. They left it in because the joke “sounded like Benchley.”)

Get the latest in beer, wine, and cocktail culture sent straight to your inbox.

Twelve years later, in “Sabrina,” Wilder had plutocrat Oliver Larrabee memorably struggle with an olive that won’t be extracted from the bottom of a bottle. His ultimate solution was to pour his Martini into the olive bottle and drink it that way. American ingenuity! In “Some Like it Hot,” Marilyn Monroe mixes up some Manhattans in a hot water bottle while on a train. Monroe is a less experienced drinker in “The Seven Year Itch.” Not knowing what a Martini is, she asks for a “big, tall” one, which Tom Ewell dutifully serves her in a Collins glass filled with ice.

You may have noticed a pattern. Wilder inserted all sorts of drinks into his films — which also include “The Lost Weekend,” “Double Indemnity,” “A Foreign Affair,” and “Sunset Boulevard” — but the Martini received the most cameos. That’s probably because it was Wilder’s drink, one he enjoyed from early adulthood in Europe to his final days. (He died in 2002 at the age of 95.)

Wilder was introduced to the Martini by another filmmaker, silent screen giant Allan Dwan. In 1927, Dwan married Ziegfeld girl Marie Shelton and Wilder was hired by Dwan’s assistant, Joe Pasternak, to guide the honeymooning couple through Germany. Wilder had previously worked in Berlin as a snappily dressed, streetwise tabloid reporter in the mode of Walter Winchell. In the 2004 book, “Wilder in Hollywood,” biographer Maurice Zolotow wrote about Wilder and Dwan’s German adventure:

He soon realized that, like many thirsty Americans coming to Europe from Prohibition-dry America, Dwan wanted to drink, more than see the sights. He loved Martinis. He introduced Wilder to the Martini. The first bar they hit, Dwan ordered a dry Martini and got a glass of Martini and Rossi vermouth, which he spat out. Eventually he and Wilder worked out a German formula to tell bartenders: “Funfzehn Teile Gin zu einem Teil Wermut, und mit Oliven.”

Translation: a 15-to-1 Martini with olives. (There was a modern cocktail bar in Berlin called Billy Wilder’s for several years, but it has sadly closed.)

During his Hollywood glory years, Wilder was known to indulge in three-Martini lunches and would often drink on the set. This sometimes got him in hot water with his colleagues. Wilder and writer Raymond Chandler famously warred over the script for “Double Indemnity,” which the two men co-wrote. Chandler was on the wagon and trying to remain so. Wilder was not and was less than sympathetic to Chandler’s struggle with the bottle. He would mix up Martinis while the two worked on the screenplay, aggravating Chandler.

The following exchange is from “Conversations with Wilder,” filmmaker Cameron Crowe’s indispensable 2001 book (now sadly out of print):

BW: …I had three Martinis before lunch, and I called girls — six girls. One of them took 15 minutes for me to get off the phone… and he was just outraged. He just could not take it, because he was impotent, I guess. And he had a wife who was much older than he was, and he was in AA, Alcoholics Anonymous — an unnecessary thing, because he got to be a drunkard again when we finished. [Wilder is poker-faced.]

CC: So it must have driven him crazy to see you having a Martini.

BW: Yes, and I had one more Martini than I should have had… because of him!

Martinis got Wilder in dutch again during “Sabrina,” when star Humphrey Bogart got it in his head that Wilder and co-star William Holden were having fun without him. “He did not like me,” Wilder told Crowe, “because in the very beginning, after the shooting, there was a little bit of drinking, like two or three Martinis, in Holden’s dressing room. I forgot to invite him. He was all by himself, in the dressing room with the hairdresser who had to put that hairpiece on there. He was not part of the crowd. I finally went to invite him and he said, ‘No, thank you very much.’”

Crowe did the world a great service by printing Wilder’s favored Martini recipe in his book. It was typical of a man of Wilder’s era, and had obviously evolved over time as vodka came to supplant gin in American Martinis. Said Wilder’s wife Audrey: “I do it by eye. I pour enough vodka for one or two Martinis, then add the vermouth. These days Billy likes Ketel One vodka. Noilly Prat vermouth is the key. I use seven or eight drops, stir, and pour it. Originally, we drank gin Martinis. The Martinis that Garbo drank were gin. After the war, vodka crept in. We started using vodka. But originally it was gin.”

So, mix up a couple Wilder Martinis before you settle in to watch the Oscars. Gin or vodka, your choice. But maybe stop before you get to 13.