Last season's third-placed SPL side were paired with either Northern Irish or Norwegian opposition at the draw for the second qualifying round in Nyon.
"The good thing about the draw is that no matter what team we get,
logistically it won't be a problem," said Saints manager Tommy Wright.
"The fact they both play each other and that Rosenborg are halfway through
their season, it gives us a good chance to get them both watched."
And Saints' fellow Scots Hibernian will take on Drogheda of Ireland or Sweden's Malmo in their tie.
Hibs boss Pat Fenlon said: "Now we've got plenty of opportunities to see both teams a few times and obtain all the relevant info.
"If we can play to our best and produce a committed and controlled performance then I believe we've got a decent chance."
Elsewhere, Northern Ireland's Glentoran play FC Reykjavik of Iceland in the first round, with Standard Liege awaiting the winners, while Linfield will face Skoda Xanthi of Greece in the second round if they can get past Faroe Islanders Fuglafjordur.
FAI Cup winners Derry City go straight into a second-round tie with Trabzonspor of Turkey, while their fellow Airtricity League side St Patrick's Athletic play Lithuanians VMFD Zalgiris for the right to a second-round tie with either FK Teteks of Macedonia or FC Pyunik of Armenia.
Prestatyn Town of Wales will meet Croatia's HNK Rijeka if they beat first-round opponents Liepajas Metalurgs of Latvia, and Bala Town play Levadia Tallinn of Estonia for the right to play Romanian side CS Pandurii Targu Jiu.
The third Welsh team in the draw, Airbus UK, play FK Ventspils of Latvia in the first round and will meet either Víkingur of the Faroes or Finland's Inter Turku if they progress.
First-round ties will be played on July 4 and 11, with second-round ties scheduled for July 18 and 25.
Europa League second qualifying round draw:
BK Hacken v Sparta Prague
Libertas/FK Sarajevo v Flora Tallinn/Kukesi
FC Thun v Chikhura Sachkhere/FC Vaduz
Xanthi v IF Fuglafjordur/Linfield
Hodd v Gandzasar Kapan/Aktobe
Dila Gori v Aalborg
Maccabi Haifa v Sliema Wanderers/Khazar Lenkoran
Hajduk Split v FK Turnovo/ FK Suduva
Airbus UK/Ventspils v Jeunesse Esch/TPS
Domzale/Astra Ploiesti v Omonia Nicosia
FC Tiraspol/Skonto FC v Liberec
Pandurii Targu Jiu v Bala Town/Levadia Tallinn
Slask Wroclaw v Rudar Pljevlja/FC Mika
Drogheda Utd/Malmo FF v Hibernian
Jagodina v Rubin Kazan
Stromsgodset v Debrecen
Petrolul Ploiesti v Vikingur/Inter Turku
Rijeka v Prestatyn Town/Liepajas Metalurgs
VMFD Zalgiris/St Patricks v Teteks/Pyunik
Beroe v Hapoel Tel-Aviv
FC Honka v Lech Poznan
Crvena Zvezda v IBV Vestmannaeyjar/HB Torshavn
Shakhtyor v FC Milsami/F91 Dudelange
Hibernians/Vojvodina v Celik/Budapest Honved
Olimpija Ljubljana v Torpedo Kutaisi/MSK Zilina
IFK Mariehamn/Inter Baku v CM Celje/Tromso
Chornomorets v KS Teuta/FC Dacia
IFK Goteborg v AS Trencin
FC Kruoja/Dinamo Minsk v Lokomotiva Zagreb
KR Reykjavik/Glentoran v Standard Liege
UE Santa Coloma/Zrinjski Mostar v Astana/ Bulgaria No.3
Metalurg Skopje/FK Karabakh v Piast Gliwice
Crusaders/Rosenborg v St Johnstone
Trabzonspor v Derry City
Fiorita/Valletta v FC Minsk
Senica v Mladost Podgorica/Videoton
Anorthosis Famagusta v Trans Narva/Gefle IF
Sturm Graz v Santa Coloma/Breidablik
Levski Sofia/Irtysh v Siroki Brijeg
Laci/FC 03 Differdange v FC Utrecht
Tie to be played 18 and 25 July