The &dir is the memory address of a variable. I think I see where you got this from (in XCode documentation), but you don’t have to use &dir, you can just put a regular boolean.
For others I have prepared a small example script which logs the info returned. Please see the console.
This needs to be attached to a button to try it.
on checkDir_(sender)
set tPanel to NSOpenPanel's openPanel()
tPanel's setCanChooseDirectories_(true)
tPanel's setCanChooseFiles_(false)
tPanel's setAllowsMultipleSelection_(false)
tPanel's setAllowedFileTypes_(missing value)
tPanel's runModal()
set tMyDir to tPanel's filenames()'s objectAtIndex_(0)
log tMyDir
set isDir to false
set tDefaultManager to NSFileManager's defaultManager()
set tAttribs to tDefaultManager's attributesOfItemAtPath_error_(tMyDir, missing value)
log tAttribs
set tFileType to tAttribs's objectForKey_("NSFileType") as string
log tFileType
if tFileType = "NSFileTypeDirectory" then
set isDir to true
beep
end if
end checkDir_