'Raspberry tart' is an example of Cockney rhyming slang. It is the source of the term 'raspberry' - the derisive sound, imitative of a fart, made pressing the lips together and 'blowing a raspberry'.
'Raspberry' has become accepted into polite language in circumstances where 'fart' might be thought unsuitable (in a manner like the term 'berk', which derives from 'Berkshire hunt' - a rhyming slang term for what is often referred to just as 'the C word'). These are presumably both acceptable as they follow the rhyming slang pattern of adopting the non-rhyming word from a slang phrase as the synonym for the original. To anyone unfamiliar with the rhyming slang origin the words 'raspberry' or 'berk' could cause no offence - similarly 'ginger', 'hampton' and 'khyber'.
This device allowed British comedians of the post-WWII period to get risqué material past the BBC censors. At that time the BBC was especially vigilant at censoring any script that might be thought to contain explicit material, as is made evident by readin their Green Book of unacceptable language. Spike Milligan, in his Goon Show scripts, made something of a game at sneaking in material which the audience would understand as a double-entendre but which the censors might miss; for example, their 1978 recording The Raspberry Song:
(Bloodnok) Don't tell me he's come to stay
(Secombe) Let the wardens here him say
Fruit's in season! Let's be merry! Apples, plums and the old raspberry
Everything is fresh today
(Bloodnok) Don't let him get near me, please!
(Secombe) Every Friday night when work is done
He doesn't waste a minute
To the prison warden he hurries 'round where he sings just like a linnet
To hear him blow a melody it's great, you can't deny it
And if you've nothing else to do,
we'd like the screws to try it
(Bloodnok) No more, please!
Milligan later collaborated with Ronnie Barker on the Two Ronnies sketches The Phantom Raspberry Blower of Old London Town. In addition to the part-writing of the script he was credited with the sound effects: "Raspberries Professionally blown by Spike Milligan."